xref: /PHP-8.1/ext/pcre/tests/002.phpt (revision ea87d048)
1--TEST--
2preg_* with bogus vals
3--FILE--
4<?php
5
6try {
7    preg_match_all('//', '', $dummy, 0xdead);
8} catch (ValueError $exception) {
9    echo $exception->getMessage() . "\n";
10}
11
12var_dump(preg_quote(''));
13
14var_dump(preg_replace('/(.)/', '${1}${1', 'abc'));
15var_dump(preg_replace('/.++\d*+[/', 'for ($', 'abc'));
16var_dump(preg_replace('/(.)/e', 'for ($', 'abc'));
17
18?>
19--EXPECTF--
20preg_match_all(): Argument #4 ($flags) must be a PREG_* constant
21string(0) ""
22string(12) "a${1b${1c${1"
23
24Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line %d
25NULL
26
27Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line %d
28NULL
29