#35821 [NEW]: array_map cause a segfault with throwed exception

From: Date: Tue, 27 Dec 2005 21:43:42 +0000
Subject: #35821 [NEW]: array_map cause a segfault with throwed exception
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91143@lists.php.net to get a copy of this message
From:             sfilteau at kronostechnologies dot com
Operating system: Gentoo
PHP version:      5.1.1
PHP Bug Type:     Reproducible crash
Bug description:  array_map cause a segfault with throwed exception

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

-- 
Edit bug report at http://bugs.php.net/?id=35821&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35821&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35821&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35821&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35821&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=35821&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35821&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35821&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35821&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35821&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35821&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=35821&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=35821&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35821&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35821&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35821&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35821&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35821&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35821&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35821&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35821&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#91143) next »