summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2012-05-12 13:19:27 +0800
committerXinchen Hui <laruence@php.net>2012-05-12 13:19:55 +0800
commit6a5095582a1e3b9a065863c9990e2f001d1cdc10 (patch)
tree02f7ef0e86786b894b7e9704e95b0dfd498e0a26
parent8b4b70df56e14be0f7172b5cc5f8da44b3272ac3 (diff)
parent3332943c9d20a8b5e09816b11f38742de0e16085 (diff)
downloadphp-git-6a5095582a1e3b9a065863c9990e2f001d1cdc10.tar.gz
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3: Fixed Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object) fix stack overflow in php_intlog10abs() Conflicts: Zend/zend_execute.c
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug62005.phpt15
-rw-r--r--Zend/zend_execute.c3
3 files changed, 18 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 371753792f..a87211298f 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ PHP NEWS
(Laruence)
- Core:
+ . Fixed bug #62005 (unexpected behavior when incrementally assigning to a
+ member of a null object). (Laruence)
. Fixed bug #61978 (Object recursion not detected for classes that implement
JsonSerializable). (Felipe)
. Fixed bug #61730 (Segfault from array_walk modifying an array passed by
diff --git a/Zend/tests/bug62005.phpt b/Zend/tests/bug62005.phpt
new file mode 100644
index 0000000000..c99b28726f
--- /dev/null
+++ b/Zend/tests/bug62005.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object)
+--FILE--
+<?php
+function add_points($player, $points) {
+ $player->energy += $points;
+ print_r($player);
+}
+add_points(NULL, 2);
+--EXPECTF--
+Warning: Creating default object from empty value in %sbug62005.php on line %d
+stdClass Object
+(
+ [energy] => 2
+)
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index d72fc7369a..205531fd28 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -554,11 +554,10 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC)
|| (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
|| (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)
) {
- zend_error(E_WARNING, "Creating default object from empty value");
-
SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
zval_dtor(*object_ptr);
object_init(*object_ptr);
+ zend_error(E_WARNING, "Creating default object from empty value");
}
}