Crash using preg_replace_callback and global variable
| Bug #44214 | Crash using preg_replace_callback and global variable | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2008-02-22 15:01 UTC | Modified: | 2008-03-08 13:12 UTC |
|
||||||||||
| From: | php at bouchery dot fr | Assigned: | ||||||||||||
| Status: | Closed | Package: | Reproducible crash | |||||||||||
| PHP Version: | 5.3.0-dev | OS: | Windows XP | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2008-02-22 15:01 UTC] php at bouchery dot fr
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
--
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2008-03-03 15:27 UTC] php at bouchery dot fr
[2008-03-03 22:31 UTC] nlopess@php.net
[2008-03-08 13:12 UTC] nlopess@php.net