Skip to content

Commit 2324917

Browse files
committed
adjust tests
1 parent f550024 commit 2324917

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

ext/pcre/tests/bug70345.phpt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
--TEST--
22
Bug #70345 (Multiple vulnerabilities related to PCRE functions)
3+
--SKIPIF--
4+
<?php
5+
if (PCRE_VERSION_MAJOR == 10 && PCRE_VERSION_MINOR < 38) {
6+
die("skip old pcre version");
7+
}
38
--FILE--
49
<?php
510
$regex = '/(?=xyz\K)/';
@@ -14,8 +19,8 @@ preg_match($regex, $subject, $matches);
1419
var_dump($matches);
1520
?>
1621
--EXPECTF--
22+
Warning: preg_split(): Compilation failed: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK) at offset 9 in %s on line %d
1723
bool(false)
1824

19-
Warning: preg_match(): Get subpatterns list failed in %s on line %d
20-
array(0) {
21-
}
25+
Warning: preg_match(): Compilation failed: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK) at offset 12 in %s on line %d
26+
NULL

ext/pcre/tests/bug70345_old.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Bug #70345 (Multiple vulnerabilities related to PCRE functions)
3+
--SKIPIF--
4+
<?php
5+
if (PCRE_VERSION_MAJOR != 10 || PCRE_VERSION_MINOR >= 38) {
6+
die("skip new pcre version");
7+
}
8+
--FILE--
9+
<?php
10+
$regex = '/(?=xyz\K)/';
11+
$subject = "aaaaxyzaaaa";
12+
13+
var_dump(preg_split($regex, $subject));
14+
15+
$regex = '/(a(?=xyz\K))/';
16+
$subject = "aaaaxyzaaaa";
17+
preg_match($regex, $subject, $matches);
18+
19+
var_dump($matches);
20+
?>
21+
--EXPECTF--
22+
bool(false)
23+
24+
Warning: preg_match(): Get subpatterns list failed in %s on line %d
25+
array(0) {
26+
}

0 commit comments

Comments
 (0)