xref: /PHP-7.0/ext/pcre/tests/bug47229.phpt (revision 54958dbc)
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--EXPECTF--
23%string|unicode%(13) "\-oh really\?"
24array(1) {
25  [0]=>
26  %string|unicode%(4) "a---"
27}
28array(1) {
29  [0]=>
30  %string|unicode%(1) "a"
31}
32array(1) {
33  [0]=>
34  %string|unicode%(5) "a----"
35}
36array(0) {
37}
38