mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
Fixed bug #30820 (static member conflict with $this->member silently ignored)
This commit is contained in:
parent
0a44789bf3
commit
d02d270f48
27
Zend/tests/bug30820.phpt
Executable file
27
Zend/tests/bug30820.phpt
Executable 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
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user