[php-src] master: Merge branch 'PHP-8.5'
Ilia Alshanetsky <[email protected]> Mon, 20 Jul 2026 23:36:07 +0000
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: Ilia Alshanetsky (iliaal)
Date: 2026-07-20T19:32:51-04:00
Commit: https://github.com/php/php-src/commit/d0f00ccd98fdceeeb092d80fa878110b31a31539
Raw diff: https://github.com/php/php-src/commit/d0f00ccd98fdceeeb092d80fa878110b31a31539.diff
Merge branch 'PHP-8.5'
* PHP-8.5:
ext/filter: encode 0xFF in FILTER_SANITIZE_ENCODED
Changed paths:
A ext/filter/tests/filter_sanitize_encoded_0xff.phpt
M ext/filter/sanitizing_filters.c
Diff:
diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c
index 456b138ca934..bdf4e7681ca1 100644
--- a/ext/filter/sanitizing_filters.c
+++ b/ext/filter/sanitizing_filters.c
@@ -68,7 +68,7 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const
const unsigned char *e = s + char_len;
zend_string *str;
- memset(tmp, 1, sizeof(tmp)-1);
+ memset(tmp, 1, sizeof(tmp));
while (s < e) {
tmp[*s++] = '\0';
diff --git a/ext/filter/tests/filter_sanitize_encoded_0xff.phpt b/ext/filter/tests/filter_sanitize_encoded_0xff.phpt
new file mode 100644
index 000000000000..1ee61aba7b70
--- /dev/null
+++ b/ext/filter/tests/filter_sanitize_encoded_0xff.phpt
@@ -0,0 +1,12 @@
+--TEST--
+FILTER_SANITIZE_ENCODED percent-encodes 0xFF
+--EXTENSIONS--
+filter
+--FILE--
+<?php
+var_dump(filter_var("\xFF", FILTER_SANITIZE_ENCODED));
+var_dump(filter_var("\xFE\xFF\x00A", FILTER_SANITIZE_ENCODED));
+?>
+--EXPECT--
+string(3) "%FF"
+string(10) "%FE%FF%00A"