|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
46 + 34 = ?
Subscribe to this entry?

 [2005-12-27 22:43 UTC] sfilteau at kronostechnologies dot com
In command line, php do a segfault when calling array_map with a callback function that throw an exception.

Reproduce code:

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)

$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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-27 23:48 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jan 28 17:03:58 2023 UTC