com php-src: Fixed bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6): NEWS ext/reflection/php_reflection .c
ext/reflection/tests/bug70982.phpt
| From: | Xinchen Hui | Date: | Fri, 27 Nov 2015 03:32:38 +0000 |
| Subject: | com php-src: Fixed bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6): NEWS ext/reflection/php_reflection .c ext/reflection/tests/bug70982.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90043@lists.php.net to get a copy of this message | ||
Commit: 6cb6c044992414fc8d985c0c24ca6f7a59d2706d
Author: Xinchen Hui <laruence@gmail.com> Fri, 27 Nov 2015 11:32:38 +0800
Parents: 99dd7ee80ba6865dfbf742935f9aadab1d65801c
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6cb6c044992414fc8d985c0c24ca6f7a59d2706d
Log:
Fixed bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6)
Bugs:
https://bugs.php..net/70982
Changed paths:
M NEWS
M ext/reflection/php_reflection.c
A ext/reflection/tests/bug70982.phpt
Diff:
diff --git a/NEWS b/NEWS
index bd6f283..635ba29 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index faced05..72df8b5 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -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);
}
diff --git a/ext/reflection/tests/bug70982.phpt b/ext/reflection/tests/bug70982.phpt
new file mode 100644
index 0000000...3d6aadd
--- /dev/null
+++ b/ext/reflection/tests/bug70982.phpt
@@ -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"