1--TEST--
2preg_replace_callback_array() errors
3--FILE--
4<?php
5
6function b() {
7    return "b";
8}
9
10// empty strings
11
12var_dump(
13    preg_replace_callback_array(
14        [
15            '/a/' => 'b',
16            '' => function () {
17                return 'ok';
18            },
19        ],
20        'a'
21    )
22);
23
24var_dump(
25    preg_replace_callback_array(
26        [
27            '/a/' => 'b',
28            null => function () {
29                return 'ok';
30            },
31        ],
32        'a'
33    )
34);
35
36// backslashes
37
38var_dump(
39    preg_replace_callback_array(
40        [
41            '/a/' => 'b',
42            "\\b\\" => function () {
43                return 'ok';
44            },
45        ],
46        'a'
47    )
48);
49
50// alphanumeric delimiters
51
52var_dump(
53    preg_replace_callback_array(
54        [
55            '/a/' => 'b',
56            'aba' => function () {
57                return 'ok';
58            },
59        ],
60        'a'
61    )
62);
63
64var_dump(
65    preg_replace_callback_array(
66        [
67            '/a/' => 'b',
68            '1b1' => function () {
69                return 'ok';
70            },
71        ],
72        'a'
73    )
74);
75
76// null character delimiter
77
78var_dump(
79    preg_replace_callback_array(
80        [
81            '/a/' => 'b',
82            "\0b\0" => function () {
83                return 'ok';
84            },
85        ],
86        'a'
87    )
88);
89
90?>
91--EXPECTF--
92Warning: preg_replace_callback_array(): Empty regular expression in %spreg_replace_callback_array_error.php on line %d
93NULL
94
95Warning: preg_replace_callback_array(): Empty regular expression in %spreg_replace_callback_array_error.php on line %d
96NULL
97
98Warning: preg_replace_callback_array(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_replace_callback_array_error.php on line %d
99NULL
100
101Warning: preg_replace_callback_array(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_replace_callback_array_error.php on line %d
102NULL
103
104Warning: preg_replace_callback_array(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_replace_callback_array_error.php on line %d
105NULL
106
107Warning: preg_replace_callback_array(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_replace_callback_array_error.php on line %d
108NULL
109