summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-08-21 17:38:03 +0800
committerXinchen Hui <laruence@gmail.com>2016-08-21 17:38:03 +0800
commit0476bb1de54896b6c062125f22318533998ce94a (patch)
tree0b7b0998189bb4606df3d5e1260254d8e3d6de4a /Zend
parent17e8a3df134fe042b12cf0482fa578fb61f02cb2 (diff)
downloadphp-git-0476bb1de54896b6c062125f22318533998ce94a.tar.gz
Fixed bug #72911 (Memleak in zend_binary_assign_op_obj_helper)
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/bug72911.phpt17
-rw-r--r--Zend/zend_execute.c4
2 files changed, 20 insertions, 1 deletions
diff --git a/Zend/tests/bug72911.phpt b/Zend/tests/bug72911.phpt
new file mode 100644
index 0000000000..098261cadf
--- /dev/null
+++ b/Zend/tests/bug72911.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #72911 (Memleak in zend_binary_assign_op_obj_helper)
+--FILE--
+<?php
+
+$a = 0;
+
+$b = $a->b->i -= 0;
+
+var_dump($b);
+
+?>
+--EXPECTF--
+Warning: Attempt to modify property of non-object in %sbug72911.php on line %d
+
+Warning: Attempt to assign property of non-object in %sbug72911.php on line %d
+NULL
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index a2ef9c3f4d..9a3f69e026 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -595,7 +595,9 @@ static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *v
static inline int make_real_object(zval *object)
{
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
- if (EXPECTED(Z_TYPE_P(object) <= IS_FALSE)) {
+ if (UNEXPECTED(object == &EG(error_zval))) {
+ return 0;
+ } else if (EXPECTED(Z_TYPE_P(object) <= IS_FALSE)) {
/* nothing to destroy */
} else if (EXPECTED((Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0))) {
zval_ptr_dtor_nogc(object);