#42119 [Opn->Asn]: array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On

From: Date: Tue, 31 Jul 2007 12:38:20 +0000
Subject: #42119 [Opn->Asn]: array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115594@lists.php.net to get a copy of this message
ID: 42119 Updated by: iliaa@php.net Reported By: rick_g22 at yahoo dot com -Status: Open +Status: Assigned Bug Type: Scripting Engine problem Operating System: Win32 PHP Version: 5.2.3 -Assigned To: +Assigned To: dmitry Previous Comments: ------------------------------------------------------------------------ [2007-07-27 01:40:50] rick_g22 at yahoo dot com Description: ------------ On PHP 5.2.3 (win32 version at least), php.ini disregards "allow_call_time_pass_reference = On" for objects, if "zend.ze1_compatibility_mode = On". This is SPECIFICALLY for uses of array_push WITH ampersand, i.e. array_push($arr,&$obj) - this code worked perfectly in PHP4, and fails in PHP5. Note 1: This bug is the opposite behavior of bug #30332 - #30332's example didn't use an ampersand when passing the objects, and this does. Note 2: A workaround is $arr[] = &$obj; Reproduce code: --------------- <?php // allow_call_time_pass_reference = On // zend.ze1_compatibility_mode = On class myclass { var $item = 1; } $arr = array(); $myobj = new myclass(); array_push($arr,&$myobj); $myobj->item = 2; echo $arr[0]->item; ?> Expected result: ---------------- 2 Actual result: -------------- 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42119&edit=1

« previous php.bugs (#115594) next »