summaryrefslogtreecommitdiff
path: root/ext/pcre/tests
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-07 17:01:39 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-07 17:01:39 +0100
commitcd5591a28d738b1b00c96c0e6cae91b490dba56d (patch)
tree0efb7c828266d7602f6462c6b67f2c1c29a543b1 /ext/pcre/tests
parentc9e78e6d338cc46dcadb39b3e2df119fa969e72b (diff)
downloadphp-git-cd5591a28d738b1b00c96c0e6cae91b490dba56d.tar.gz
PCRE: Only remember valid UTF-8 if start offset zero
PCRE only validates the string starting from the start offset (minus maximum look-behind, but let's ignore that), so we can only remember that the string is fully valid UTF-8 is the original start offset is zero.
Diffstat (limited to 'ext/pcre/tests')
-rw-r--r--ext/pcre/tests/bug79241.phpt11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/pcre/tests/bug79241.phpt b/ext/pcre/tests/bug79241.phpt
index 92e5253735..f6dbb8bea4 100644
--- a/ext/pcre/tests/bug79241.phpt
+++ b/ext/pcre/tests/bug79241.phpt
@@ -15,8 +15,19 @@ var_dump(preg_match($pattern, $text, $matches, 0, 0));
var_dump(preg_match($pattern, $text, $matches, 0, 1));
var_dump(preg_last_error() == PREG_BAD_UTF8_OFFSET_ERROR);
+echo "\n";
+
+$text = "VA\xff"; $text .= "LID";
+var_dump(preg_match($pattern, $text, $matches, 0, 4));
+var_dump(preg_match($pattern, $text, $matches, 0, 0));
+var_dump(preg_last_error() == PREG_BAD_UTF8_ERROR);
+
?>
--EXPECT--
int(0)
bool(false)
bool(true)
+
+int(1)
+bool(false)
+bool(true)