diff options
| author | Dmitry Stogov <dmitry@php.net> | 2007-08-01 10:56:45 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2007-08-01 10:56:45 +0000 |
| commit | a382ede3e8b5fecfb44575fea6c079c69e7ad055 (patch) | |
| tree | d7511d02606f24175e58e8204ae5e2d896ff0382 | |
| parent | 8589a7f4736b693c0398c51df8c2603755ba481d (diff) | |
| download | php-git-a382ede3e8b5fecfb44575fea6c079c69e7ad055.tar.gz | |
Fixed bug #42119 (array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On)
| -rw-r--r-- | NEWS | 2 | ||||
| -rwxr-xr-x | Zend/tests/bug42119.phpt | 19 | ||||
| -rw-r--r-- | Zend/zend_API.c | 4 |
3 files changed, 24 insertions, 1 deletions
@@ -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; |
