Fixed bug #30820 (static member conflict with $this->member silently ignored)

This commit is contained in:
Dmitry Stogov 2005-06-08 08:08:18 +00:00
parent 0a44789bf3
commit d02d270f48
2 changed files with 30 additions and 0 deletions

27
Zend/tests/bug30820.phpt Executable file
View File

@ -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

View File

@ -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 {