#30166 [Opn->Csd]: dereferencing object in an array -> segfault
| From: | iliaa@php.net | Date: | Mon, 27 Sep 2004 17:54:40 +0000 |
| Subject: | #30166 [Opn->Csd]: dereferencing object in an array -> segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66772@lists.php.net to get a copy of this message | ||
ID: 30166
Updated by: iliaa@php.net
Reported By: cat at final-frontier dot ath dot cx
-Status: Open
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: Gentoo Linux
PHP Version: 5.0.1
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:
------------------------------------------------------------------------
[2004-09-20 13:06:28] cat at final-frontier dot ath dot cx
Description:
------------
When dereferencing an object-reference in an array, php gets a
segfault.
(see reproduce code)
Okay, I know that $object here is out of scope and should be subject to
the GC, but PHP should still not segfault, but report an error or
something like that. This bug makes horde-imp not work anymore on PHP 5
- the same code seems to have worked on PHP 4 (can't verify that,
sorry).
Reproduce code:
---------------
<?php
class testobject
{
var $test;
}
function return_object()
{
$object = new testobject;
$object->test = "lala";
$array = array( &$object, NULL );
return $array;
}
$object = return_object();
$object = $object[0]; // segmentation fault on this line
echo "WORKED: " . $object->test . "\n";
?>
Expected result:
----------------
The script prints out "WORKED: lala" or an error that the array-index
is not present (or something like that).
Actual result:
--------------
(empty page, "[Mon Sep 20 12:45:01 2004] [notice] child pid 2075 exit
signal Segmentation fault (11)" in apache-log)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30166&edit=1