#29253 [Opn->Ver]: array_diff with $GLOBALS argument fails apache.(zend optimizer running)
| From: | andrey@php.net | Date: | Sat, 07 Aug 2004 11:42:33 +0000 |
| Subject: | #29253 [Opn->Ver]: array_diff with $GLOBALS argument fails apache.(zend optimizer running) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-64221@lists.php.net to get a copy of this message | ||
ID: 29253
Updated by: andrey@php.net
Reported By: camka at email dot ee
-Status: Open
+Status: Verified
Bug Type: Arrays related
Operating System: Unix, Win2000
PHP Version: 4.3.8
New Comment:
To my knowledge array_diff* do not unset anything. I confirm the
behaviour under 5.1.0-dev (of 7.Aug.2004) as well as with 4.2.3 (so
this problem exists also in the old implementation of the function).
The problem appears when only $GLOBALS is used, and the latter is a
variable (array) with specific behaviour. Unfortunately I wasn't able
to reproduce similar problem with one of the other array functions.
Previous Comments:
------------------------------------------------------------------------
[2004-07-20 14:40:32] camka at email dot ee
last win snapshot
<?php
error_reporting(E_ALL);
$zz = $GLOBALS;
$ff = 'ff';
array_diff_assoc($GLOBALS, $zz);
var_dump($zz); // this line crashes apache when optimizer is running
?>
when optimizer is disabled gives the following notice message and
doesn't crash
Notice: Undefined variable: zz in c:\wwwww\test\crashme.php on line 7
NULL
seems like array_diff parameters are being unset inside the function
------------------------------------------------------------------------
[2004-07-20 02:44:32] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2004-07-19 09:58:31] camka at email dot ee
Description:
------------
when using array_diff with one of the parameters is $GLOBALS seems like
the whole variable scope is messed up.
Reproduce code:
---------------
<?php
$zz = $GLOBALS;
$gg = 'afad';
var_dump(array_diff_assoc($GLOBALS, $zz));
echo $gg; // strange behavour. $gg is like an array!!!
// var_dump($gg); // this call fails apache
?>
Expected result:
----------------
expect seeing 'afad' and empty array;
Actual result:
--------------
array(0) { } Arra
the length of "Arra" string depends on the length of $gg length;
if uncomment the last line - apache child fails
[Mon Jul 19 10:26:00 2004] [notice] child pid 10946 exit signal
Segmentation fault (11
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29253&edit=1