summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-08-01 10:56:45 +0000
committerDmitry Stogov <dmitry@php.net>2007-08-01 10:56:45 +0000
commita382ede3e8b5fecfb44575fea6c079c69e7ad055 (patch)
treed7511d02606f24175e58e8204ae5e2d896ff0382
parent8589a7f4736b693c0398c51df8c2603755ba481d (diff)
downloadphp-git-a382ede3e8b5fecfb44575fea6c079c69e7ad055.tar.gz
Fixed bug #42119 (array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On)
-rw-r--r--NEWS2
-rwxr-xr-xZend/tests/bug42119.phpt19
-rw-r--r--Zend/zend_API.c4
3 files changed, 24 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index e17841036a..6d391895f3 100644
--- a/NEWS
+++ b/NEWS
@@ -78,6 +78,8 @@ PHP NEWS
(Ilia)
- Fixed bug #42134 (oci_error() returns false after oci_new_collection()
fails). (Tony)
+- Fixed bug #42119 (array_push($arr,&$obj) doesn't work with
+ zend.ze1_compatibility_mode On). (Dmitry)
- Fixed Bug #42112 (deleting a node produces memory corruption). (Rob)
- Fixed Bug #42107 (sscanf broken when using %2$s format parameters). (Jani)
- Fixed bug #42090 (json_decode causes segmentation fault). (Hannes)
diff --git a/Zend/tests/bug42119.phpt b/Zend/tests/bug42119.phpt
new file mode 100755
index 0000000000..79d70f0aed
--- /dev/null
+++ b/Zend/tests/bug42119.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #42119 (array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On)
+--INI--
+allow_call_time_pass_reference=1
+zend.ze1_compatibility_mode=1
+--FILE--
+<?php
+class myclass {
+ var $item = 1;
+}
+
+$arr = array();
+@$myobj = new myclass();
+array_push($arr,&$myobj);
+$myobj->item = 2;
+echo $arr[0]->item,"\n";
+?>
+--EXPECT--
+2
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 96aaa47c9f..5092e8ca72 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -154,7 +154,9 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
while (param_count-->0) {
zval **value = (zval**)(p-arg_count);
- if (EG(ze1_compatibility_mode) && Z_TYPE_PP(value) == IS_OBJECT) {
+ if (EG(ze1_compatibility_mode) &&
+ Z_TYPE_PP(value) == IS_OBJECT &&
+ !(*value)->is_ref) {
zval *value_ptr;
char *class_name;
zend_uint class_name_len;