php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35821 array_map cause a segfault with throwed exception
Submitted: 2005-12-27 22:43 UTC Modified: 2005-12-27 23:48 UTC
From: sfilteau at kronostechnologies dot com Assigned: tony2001 (profile)
Status: Closed Package: Reproducible crash
PHP Version: 5.1.1 OS: Gentoo
Private report: No CVE-ID: None
 [2005-12-27 22:43 UTC] sfilteau at kronostechnologies dot com
Description:
------------
In command line, php do a segfault when calling array_map with a callback function that throw an exception.

Reproduce code:
---------------
<?php

class Element
{
        public function ThrowException ()
        {
                echo "This line will do a Segfault : ";
                throw new Exception('How to do a segfault?');
        }

        public static function CallBack(Element $elem)
        {
                $elem->ThrowException();
        }
}

$arr = array(new Element(), new Element(), new Element());
array_map(array('Element', 'CallBack'), $arr);

?>

Expected result:
----------------
This line will do a Segfault : This line will do a Segfault : This line will do a Segfault : 

Actual result:
--------------
sylvain@stage ~ $ ./testarraymap.php
This line will do a Segfault : Segmentation fault

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-27 23:48 UTC] tony2001@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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC