summaryrefslogtreecommitdiff
path: root/Zend/tests/self_method_or_prop_outside_class.phpt
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-12-14 17:30:45 +0100
committerNikita Popov <nikic@php.net>2015-12-14 17:31:37 +0100
commit7078627d22c1d32a17b193eb6bfe83242d877371 (patch)
tree18a4d6c8720d16ccfcb05fb020685933fc40127c /Zend/tests/self_method_or_prop_outside_class.phpt
parenta63f33b2822e59ebe1c48bb12730f3fcc64d8a69 (diff)
downloadphp-git-7078627d22c1d32a17b193eb6bfe83242d877371.tar.gz
Fix leaks due to UNUSED CE fetch
Diffstat (limited to 'Zend/tests/self_method_or_prop_outside_class.phpt')
-rw-r--r--Zend/tests/self_method_or_prop_outside_class.phpt36
1 files changed, 36 insertions, 0 deletions
diff --git a/Zend/tests/self_method_or_prop_outside_class.phpt b/Zend/tests/self_method_or_prop_outside_class.phpt
new file mode 100644
index 0000000000..e4a499def8
--- /dev/null
+++ b/Zend/tests/self_method_or_prop_outside_class.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Accessing self:: properties or methods outside a class
+--FILE--
+<?php
+
+$fn = function() {
+ $str = "foo";
+ try {
+ self::${$str . "bar"};
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ unset(self::${$str . "bar"});
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ isset(self::${$str . "bar"});
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ self::{$str . "bar"}();
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+};
+$fn();
+
+?>
+--EXPECT--
+Cannot access self:: when no class scope is active
+Cannot access self:: when no class scope is active
+Cannot access self:: when no class scope is active
+Cannot access self:: when no class scope is active