xref: /PHP-8.1/ext/pcre/tests/bug47229.phpt (revision f72b6c5e)
1--TEST--
2Bug #47229 (preg_quote() doesn't escape -)
3--FILE--
4<?php
5
6var_dump(preg_quote('-oh really?'));
7
8// make sure there's no regression in matching
9preg_match('/[a\-c]+/', 'a---b', $m);
10var_dump($m);
11
12preg_match('/[a\-c]+/', 'a\-', $m);
13var_dump($m);
14
15preg_match("/a\-{2,}/", 'a----a', $m);
16var_dump($m);
17
18preg_match("/a\-{1,}/", 'a\----a', $m);
19var_dump($m);
20
21?>
22--EXPECT--
23string(13) "\-oh really\?"
24array(1) {
25  [0]=>
26  string(4) "a---"
27}
28array(1) {
29  [0]=>
30  string(1) "a"
31}
32array(1) {
33  [0]=>
34  string(5) "a----"
35}
36array(0) {
37}
38