From:             php at bouchery dot fr
Operating system: Windows XP
PHP version:      5.2.5
PHP Bug Type:     Reproducible crash
Bug description:  Crash using preg_replace_callback and global variable

Description:
------------
When assigning callback parameter of preg_replace_callback into a global
variable, PHP CLI interpreter crash at the end of the script.
I generate this error with PHP v5.2.3.3, and I try the last 5.2.5.5, but
the result is the same.

Reproduce code:
---------------
<?php
$string = 'aaa bbb ccc ddd eee ccc aaa bbb';

$array = array();

function myCallBack( $match ) {
    global $array;
    $array[] = $match;
    return 'xxx';
}

echo preg_replace_callback( '`a+`', 'myCallBack', $string);
?>

Expected result:
----------------
No crash at the end of the script.

Actual result:
--------------
Windows crash report with signature error.
---
AppName: php.exe  AppVer: 5.2.5.5  ModName: php5ts.dll
ModVer: 5.2.5.5  Offset: 0009a10a
--

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

Reply via email to