1--TEST--
2preg_replace_callback_array() errors
3--FILE--
4<?php
5
6$a = array();
7$b = "";
8
9try {
10    var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b));
11} catch (\TypeError $e) {
12    echo $e->getMessage() . \PHP_EOL;
13}
14
15
16var_dump($b);
17function f() {
18    static $count = 1;
19    throw new Exception($count);
20}
21
22var_dump(preg_replace_callback_array(array('/\w' => 'f'), 'z'));
23
24try {
25    var_dump(preg_replace_callback_array(array('/\w/' => 'f', '/.*/' => 'f'), 'z'));
26} catch (Exception $e) {
27    var_dump($e->getMessage());
28}
29
30echo "Done\n";
31?>
32--EXPECTF--
33preg_replace_callback_array(): Argument #1 ($pattern) must contain only valid callbacks
34string(0) ""
35
36Warning: preg_replace_callback_array(): No ending delimiter '/' found in %spreg_replace_callback_array2.php on line %d
37NULL
38string(1) "1"
39Done
40