1--TEST-- 2preg_replace_callback_array() errors 3--FILE-- 4<?php 5 6var_dump(preg_replace_callback_array()); 7var_dump(preg_replace_callback_array(1)); 8var_dump(preg_replace_callback_array(1,2)); 9var_dump(preg_replace_callback_array(1,2,3)); 10$a = 5; 11var_dump(preg_replace_callback_array(1,2,3,$a)); 12$a = ""; 13var_dump(preg_replace_callback_array(array("" => ""),"","",$a)); 14$a = array(); 15$b = ""; 16var_dump(preg_replace_callback($a, $a, $a, $a, $b)); 17var_dump($b); 18$b = ""; 19var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b)); 20var_dump($b); 21function f() { 22 static $count = 1; 23 throw new Exception($count); 24} 25 26var_dump(preg_replace_callback_array(array('/\w' => 'f'), 'z')); 27 28try { 29 var_dump(preg_replace_callback_array(array('/\w/' => 'f', '/.*/' => 'f'), 'z')); 30} catch (Exception $e) { 31 var_dump($e->getMessage()); 32} 33 34echo "Done\n"; 35?> 36--EXPECTF-- 37Warning: preg_replace_callback_array() expects at least 2 parameters, 0 given in %s on line %d 38NULL 39 40Warning: preg_replace_callback_array() expects at least 2 parameters, 1 given in %s on line %d 41NULL 42 43Warning: preg_replace_callback_array() expects parameter 1 to be array, integer given in %s on line %d 44NULL 45 46Warning: preg_replace_callback_array() expects parameter 1 to be array, integer given in %s on line %d 47NULL 48 49Warning: preg_replace_callback_array() expects parameter 1 to be array, integer given in %s on line %d 50NULL 51 52Warning: preg_replace_callback_array() expects parameter 3 to be integer, string given in %s on line %d 53NULL 54 55Warning: preg_replace_callback() expects parameter 4 to be integer, array given in %s on line %d 56NULL 57string(0) "" 58 59Warning: preg_replace_callback_array(): 's' is not a valid callback in %spreg_replace_callback_array2.php on line %d 60array(0) { 61} 62string(0) "" 63 64Warning: preg_replace_callback_array(): No ending delimiter '/' found in %spreg_replace_callback_array2.php on line %d 65NULL 66string(1) "1" 67Done 68