1--TEST-- 2Bug #44214-2 (crash with preg_replace_callback() and global variable) 3--FILE-- 4<?php 5$string = 'aaa bbb ccc ddd eee ccc aaa bbb'; 6 7$array = array(); 8 9function myCallBack( $match ) { 10 global $array; 11 $array[] = $match[0]; 12 return 'xxx'; 13} 14 15var_dump(preg_replace_callback( '`a+`', 'myCallBack', $string)); 16var_dump($array); 17?> 18--EXPECT-- 19string(31) "xxx bbb ccc ddd eee ccc xxx bbb" 20array(2) { 21 [0]=> 22 string(3) "aaa" 23 [1]=> 24 string(3) "aaa" 25} 26