diff options
author | Dmitry Stogov <dmitry@php.net> | 2005-06-08 08:08:18 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2005-06-08 08:08:18 +0000 |
commit | d02d270f48699a81ff950df8c07e13d7964b3ba3 (patch) | |
tree | e9392812b77b18c09d1fc67f6b5194699e1171d6 /Zend | |
parent | 0a44789bf3e8b3b6c70c4bd8c07367a9a62cc3bd (diff) | |
download | php-git-d02d270f48699a81ff950df8c07e13d7964b3ba3.tar.gz |
Fixed bug #30820 (static member conflict with $this->member silently ignored)
Diffstat (limited to 'Zend')
-rwxr-xr-x | Zend/tests/bug30820.phpt | 27 | ||||
-rw-r--r-- | Zend/zend_object_handlers.c | 3 |
2 files changed, 30 insertions, 0 deletions
diff --git a/Zend/tests/bug30820.phpt b/Zend/tests/bug30820.phpt new file mode 100755 index 0000000000..97e46e9287 --- /dev/null +++ b/Zend/tests/bug30820.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #30820 (static member conflict with $this->member silently ignored) +--INI-- +error_reporting=4095 +--FILE-- +<?php +class Blah { + private static $x; + + public function show() { + Blah::$x = 1; + $this->x = 5; // no warning, but refers to different variable + + echo 'Blah::$x = '. Blah::$x ."\n"; + echo '$this->x = '. $this->x ."\n"; + } +} + +$b = new Blah(); +$b->show(); +?> +--EXPECTF-- +Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 7 +Blah::$x = 1 + +Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 10 +$this->x = 5 diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 83e80428d6..a0348a1ac4 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -168,6 +168,9 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce * continue checking below... */ } else { + if (!silent && (property_info->flags & ZEND_ACC_STATIC)) { + zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name, Z_STRVAL_P(member)); + } return property_info; } } else { |