#42119 [NEW]: array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On
| From: | rick_g22 at yahoo dot com | Date: | Fri, 27 Jul 2007 01:40:50 +0000 |
| Subject: | #42119 [NEW]: array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-115488@lists.php.net to get a copy of this message | ||
From: rick_g22 at yahoo dot com
Operating system: Win32
PHP version: 5.2.3
PHP Bug Type: Scripting Engine problem
Bug description: array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On
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 bug report at http://bugs.php.net/?id=42119&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42119&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42119&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42119&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42119&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42119&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42119&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42119&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42119&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42119&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42119&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42119&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42119&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42119&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42119&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42119&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42119&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42119&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42119&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42119&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42119&r=mysqlcfg