From f9dc073b04b4b2bcfd46d39f140d2747ac5f8c2f Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Sat, 27 Sep 2025 12:43:28 +0200 Subject: [PATCH 1/2] Add stream filter convert.* tests (#19976) The convert.* filters are quite untested so this tries to improve it. Closes GH-19976 --- ext/standard/tests/filters/convert.phpt | 130 ++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 ext/standard/tests/filters/convert.phpt diff --git a/ext/standard/tests/filters/convert.phpt b/ext/standard/tests/filters/convert.phpt new file mode 100644 index 0000000000000..a99579b5dd8fe --- /dev/null +++ b/ext/standard/tests/filters/convert.phpt @@ -0,0 +1,130 @@ +--TEST-- +convert stream filter tests +--FILE-- + 20, 'line-break-chars' => "\n"); +test_roundtrip("Long text that will be wrapped", "convert.base64-encode", "convert.base64-decode", $opts); + +$opts2 = array('binary' => true); +test_roundtrip("Text\t\r\n", "convert.quoted-printable-encode", "convert.quoted-printable-decode", $opts2); + +$fp = tmpfile(); +fwrite($fp, "Test"); +rewind($fp); +stream_filter_prepend($fp, 'convert.base64-encode', STREAM_FILTER_READ); +$result = stream_get_contents($fp); +fclose($fp); +var_dump($result === base64_encode("Test")); + +?> +--EXPECTF-- +Filter: convert.base64-encode +Original: Hello World! +Encoded: SGVsbG8gV29ybGQh +Decoded: Hello World! +bool(true) + +Filter: convert.base64-encode +Original (hex): 414243ff +Encoded: QUJD/w== +Decoded (hex): 414243ff +bool(true) + +Filter: convert.base64-encode +Original: +Encoded: +Decoded: +bool(true) + +Filter: convert.base64-encode +Original: A +Encoded: QQ== +Decoded: A +bool(true) + +Filter: convert.quoted-printable-encode +Original: Hello World! +Encoded: Hello World! +Decoded: Hello World! +bool(true) + +Filter: convert.quoted-printable-encode +Original: Line1 +Line2 +Encoded: Line1=0D=0ALine2 +Decoded: Line1 +Line2 +bool(true) + +Filter: convert.base64-encode +Original: Long text that will be wrapped +Encoded: TG9uZyB0ZXh0IHRoYXQg +d2lsbCBiZSB3cmFwcGVk +Decoded: Long text that will be wrapped +bool(true) + +Filter: convert.quoted-printable-encode +Original: Text + +Encoded: Text=09=0D=0A +Decoded: Text + +bool(true) + +bool(true) From 43c3afeff78f114bc3b8b281cbdae8c5a700c416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 27 Sep 2025 13:16:09 +0200 Subject: [PATCH 2/2] Fix Uri\WhatWg\Url::withPort() when an invalid value is passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cherry-picked from https://github.com/lexbor/lexbor/commit/4ccbc549bc46e59b904ea5411dfbc0644b8c67b9 Co-authored-by: Tim Düsterhus --- NEWS | 3 +++ ext/lexbor/lexbor/url/url.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 27a7d04b633b2..10d9064782291 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ PHP NEWS - Opcache . Fixed segfault in function JIT due to NAN to bool warning. (Girgias) +- URI: + . Fixed Uri\WhatWg\Url::withPort() when an invalid value is passed. (timwolla) + 25 Sep 2025, PHP 8.5.0RC1 - Core: diff --git a/ext/lexbor/lexbor/url/url.c b/ext/lexbor/lexbor/url/url.c index 7bc9a0b8945f4..25c571f1bf34b 100644 --- a/ext/lexbor/lexbor/url/url.c +++ b/ext/lexbor/lexbor/url/url.c @@ -1906,7 +1906,7 @@ lxb_url_parse_basic_h(lxb_url_parser_t *parser, lxb_url_t *url, { if (begin == p) { if (override_state != LXB_URL_STATE__UNDEF) { - lxb_url_parse_return(orig_data, buf, LXB_STATUS_OK); + lxb_url_parse_return(orig_data, buf, LXB_STATUS_ERROR); } state = LXB_URL_STATE_PATH_START_STATE;