php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30166 dereferencing object in an array -> segfault
Submitted: 2004-09-20 13:06 UTC Modified: 2004-09-27 19:54 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: cat at final-frontier dot ath dot cx Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.1 OS: Gentoo Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cat at final-frontier dot ath dot cx
New email:
PHP Version: OS:

 

 [2004-09-20 13:06 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-27 19:54 UTC] iliaa@php.net
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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 01:01:34 2025 UTC