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

From: Date: Wed, 01 Aug 2007 10:56:51 +0000
Subject: #42119 [Asn->Csd]: 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-115635@lists.php.net to get a copy of this message
ID: 42119 Updated by: dmitry@php.net Reported By: rick_g22 at yahoo dot com -Status: Assigned +Status: Closed Bug Type: Scripting Engine problem Operating System: Win32 PHP Version: 5.2.3 Assigned To: dmitry New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. 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 (#115635) next »