Fixed bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6)

This commit is contained in:
Xinchen Hui 2015-11-27 11:32:38 +08:00
parent 99dd7ee80b
commit 6cb6c04499
3 changed files with 27 additions and 0 deletions

4
NEWS
View File

@ -30,6 +30,10 @@ PHP NEWS
- Phpdbg:
. Fixed stderr being written to stdout. (Bob)
- Reflection:
. Fixed bug #70982 (setStaticPropertyValue behaviors inconsistently with
5.6). (Laruence)
- Standard:
. Fixed bug #70960 (ReflectionFunction for array_unique returns wrong number
of parameters). (Laruence)

View File

@ -3858,6 +3858,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
"Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
return;
}
ZVAL_DEREF(variable_ptr);
zval_ptr_dtor(variable_ptr);
ZVAL_COPY(variable_ptr, value);
}

View File

@ -0,0 +1,22 @@
--TEST--
Bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6)
--FILE--
<?php
class Foo {
static $abc;
function __construct()
{
var_dump(static::$abc);
}
}
class Bar extends Foo {
}
$rf = new ReflectionClass('Bar');
$rf->setStaticPropertyValue('abc', 'hi');
$foo = $rf->newInstance();
?>
--EXPECT--
string(2) "hi"