summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-11-27 11:32:38 +0800
committerXinchen Hui <laruence@gmail.com>2015-11-27 11:32:38 +0800
commit6cb6c044992414fc8d985c0c24ca6f7a59d2706d (patch)
tree7b5ab48691509cf3626ab889f6de4e0905c7ea88 /ext/reflection
parent99dd7ee80ba6865dfbf742935f9aadab1d65801c (diff)
downloadphp-git-6cb6c044992414fc8d985c0c24ca6f7a59d2706d.tar.gz
Fixed bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6)
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/php_reflection.c1
-rw-r--r--ext/reflection/tests/bug70982.phpt22
2 files changed, 23 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index faced0572c..72df8b5901 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 0000000000..3d6aadde4d
--- /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"