From 00affe43aaf0734f85b759ff0f790c316f604b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 23 Apr 2025 16:21:13 +0200 Subject: [PATCH 1/4] fileinfo: Show libmagic version with `.` in PHPInfo output (#18399) This makes the output in PHPInfo a little more readable. --- ext/fileinfo/fileinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 1dcc3346edfcc..143b8ba080fc5 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -115,10 +115,10 @@ ZEND_GET_MODULE(fileinfo) /* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(fileinfo) { - char magic_ver[5]; + char magic_ver[15]; - (void)snprintf(magic_ver, 4, "%d", magic_version()); - magic_ver[4] = '\0'; + int raw_version = magic_version(); + (void)snprintf(magic_ver, sizeof(magic_ver), "%d.%d", raw_version / 100, raw_version % 100); php_info_print_table_start(); php_info_print_table_row(2, "fileinfo support", "enabled"); From d6e70e705323a50b616ffee9402245ab97de3e4e Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:44:23 +0200 Subject: [PATCH 2/4] Fix DOM tests for upcoming libxml2 serializer changes DOM HTML serializer will be closer compliant to HTML5 in the next libxml2 version, so the tests need to be adapted. Ref: https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/309 Closes GH-18406. --- ext/dom/tests/DOMElement_toggleAttribute.phpt | 6 +++--- ext/dom/tests/gh10234.phpt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/dom/tests/DOMElement_toggleAttribute.phpt b/ext/dom/tests/DOMElement_toggleAttribute.phpt index ed29be899dac2..b9e9989e1fe09 100644 --- a/ext/dom/tests/DOMElement_toggleAttribute.phpt +++ b/ext/dom/tests/DOMElement_toggleAttribute.phpt @@ -87,7 +87,7 @@ echo "Checking toggled namespace:\n"; var_dump($dom->documentElement->getAttribute('xmlns:anotheron')); ?> ---EXPECT-- +--EXPECTF-- Invalid Character Error --- Selected attribute tests (HTML) --- bool(false) @@ -95,10 +95,10 @@ bool(false) bool(true) - + bool(true) - + bool(false) diff --git a/ext/dom/tests/gh10234.phpt b/ext/dom/tests/gh10234.phpt index 5edc8fc6c1ff1..11d39cd625a79 100644 --- a/ext/dom/tests/gh10234.phpt +++ b/ext/dom/tests/gh10234.phpt @@ -55,7 +55,7 @@ $document->documentElement->textContent = "quote 'test'"; var_dump($document->documentElement->textContent); var_dump($document->saveHTML()); ?> ---EXPECT-- +--EXPECTF-- -- Attribute tests -- string(38) " " @@ -67,10 +67,10 @@ string(13) "hello & world" string(50) " " string(9) "hi" -string(54) " +string(%d) "hi<\/b>")%r> " string(12) "quote "test"" -string(45) " +string(%d) " " string(12) "quote 'test'" string(45) " From 0e1bbf9259f1b6afbab5cca6f9243c5de6f69d53 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Wed, 23 Apr 2025 17:44:17 +0100 Subject: [PATCH 3/4] Add PHP 8.4 to the list --- docs/release-process.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-process.md b/docs/release-process.md index 4c37d2b087390..eaaa8f76af8b3 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -6,6 +6,7 @@ repository available according to the release schedule. The release schedule for each version is published on the [PHP wiki](https://wiki.php.net): +- [PHP 8.4](https://wiki.php.net/todo/php84) - [PHP 8.3](https://wiki.php.net/todo/php83) - [PHP 8.2](https://wiki.php.net/todo/php82) - [PHP 8.1](https://wiki.php.net/todo/php81) From 7831f65f83ac63848c5b63ed4198cdad704a2ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 23 Apr 2025 18:57:32 +0200 Subject: [PATCH 4/4] fileinfo: Stop calling `finfo_close()` in tests (#18405) This function is a noop and will be proposed for deprecation. This patch removes the useless calls. --- ext/fileinfo/tests/bug79756.phpt | 1 - ext/fileinfo/tests/cve-2014-1943-mb.phpt | 2 -- ext/fileinfo/tests/cve-2014-1943.phpt | 2 -- ext/fileinfo/tests/cve-2014-3538-mb.phpt | 1 - ext/fileinfo/tests/cve-2014-3538-nojit.phpt | 1 - ext/fileinfo/tests/cve-2014-3538.phpt | 1 - ext/fileinfo/tests/finfo_buffer_basic-mb.phpt | 1 - ext/fileinfo/tests/finfo_buffer_basic.phpt | 1 - ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt | 2 -- ext/fileinfo/tests/finfo_set_flags_basic.phpt | 2 -- ext/fileinfo/tests/finfo_upstream.phpt | 1 - 11 files changed, 15 deletions(-) diff --git a/ext/fileinfo/tests/bug79756.phpt b/ext/fileinfo/tests/bug79756.phpt index b4ea28baaa9b2..ad5478b62de8e 100644 --- a/ext/fileinfo/tests/bug79756.phpt +++ b/ext/fileinfo/tests/bug79756.phpt @@ -7,7 +7,6 @@ fileinfo $filename = __DIR__ . '/bug79756.xls'; $finfo = finfo_open(FILEINFO_MIME); $mime = finfo_file($finfo, $filename); -finfo_close($finfo); echo $mime; ?> --EXPECT-- diff --git a/ext/fileinfo/tests/cve-2014-1943-mb.phpt b/ext/fileinfo/tests/cve-2014-1943-mb.phpt index 9dd4a9ec18a5a..01cf70b811bea 100644 --- a/ext/fileinfo/tests/cve-2014-1943-mb.phpt +++ b/ext/fileinfo/tests/cve-2014-1943-mb.phpt @@ -15,13 +15,11 @@ $m = "0 byte x\n". file_put_contents($fd, $a); $fi = finfo_open(FILEINFO_NONE); var_dump(finfo_file($fi, $fd)); -finfo_close($fi); file_put_contents($fd, $b); file_put_contents($fm, $m); $fi = finfo_open(FILEINFO_NONE, $fm); var_dump(finfo_file($fi, $fd)); -finfo_close($fi); ?> Done --CLEAN-- diff --git a/ext/fileinfo/tests/cve-2014-1943.phpt b/ext/fileinfo/tests/cve-2014-1943.phpt index 35f66148ae79c..1aee196d16ffc 100644 --- a/ext/fileinfo/tests/cve-2014-1943.phpt +++ b/ext/fileinfo/tests/cve-2014-1943.phpt @@ -15,13 +15,11 @@ $m = "0 byte x\n". file_put_contents($fd, $a); $fi = finfo_open(FILEINFO_NONE); var_dump(finfo_file($fi, $fd)); -finfo_close($fi); file_put_contents($fd, $b); file_put_contents($fm, $m); $fi = finfo_open(FILEINFO_NONE, $fm); var_dump(finfo_file($fi, $fd)); -finfo_close($fi); ?> Done --CLEAN-- diff --git a/ext/fileinfo/tests/cve-2014-3538-mb.phpt b/ext/fileinfo/tests/cve-2014-3538-mb.phpt index e6c63e35ac852..3b158a26b7264 100644 --- a/ext/fileinfo/tests/cve-2014-3538-mb.phpt +++ b/ext/fileinfo/tests/cve-2014-3538-mb.phpt @@ -19,7 +19,6 @@ $fi = finfo_open(FILEINFO_NONE); $t = microtime(true); var_dump(finfo_file($fi, $fd)); $t = microtime(true) - $t; -finfo_close($fi); if ($t < 3) { echo "Ok\n"; } else { diff --git a/ext/fileinfo/tests/cve-2014-3538-nojit.phpt b/ext/fileinfo/tests/cve-2014-3538-nojit.phpt index 2010d538da951..73ecd09561d84 100644 --- a/ext/fileinfo/tests/cve-2014-3538-nojit.phpt +++ b/ext/fileinfo/tests/cve-2014-3538-nojit.phpt @@ -23,7 +23,6 @@ $fi = finfo_open(FILEINFO_NONE); $t = microtime(true); var_dump(finfo_file($fi, $fd)); $t = microtime(true) - $t; -finfo_close($fi); if ($t < 1.5) { echo "Ok\n"; } else { diff --git a/ext/fileinfo/tests/cve-2014-3538.phpt b/ext/fileinfo/tests/cve-2014-3538.phpt index f15e745fc05d3..d19278d1dc325 100644 --- a/ext/fileinfo/tests/cve-2014-3538.phpt +++ b/ext/fileinfo/tests/cve-2014-3538.phpt @@ -19,7 +19,6 @@ $fi = finfo_open(FILEINFO_NONE); $t = microtime(true); var_dump(finfo_file($fi, $fd)); $t = microtime(true) - $t; -finfo_close($fi); if ($t < 1.5) { echo "Ok\n"; } else { diff --git a/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt b/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt index 7426c909d9763..0ed6d48c803cb 100644 --- a/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt +++ b/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt @@ -27,7 +27,6 @@ foreach( $options as $option ) { foreach( $buffers as $string ) { var_dump( finfo_buffer( $finfo, $string, $option ) ); } - finfo_close( $finfo ); } ?> diff --git a/ext/fileinfo/tests/finfo_buffer_basic.phpt b/ext/fileinfo/tests/finfo_buffer_basic.phpt index e338583fab702..6a6e6a7a862cb 100644 --- a/ext/fileinfo/tests/finfo_buffer_basic.phpt +++ b/ext/fileinfo/tests/finfo_buffer_basic.phpt @@ -27,7 +27,6 @@ foreach( $options as $option ) { foreach( $buffers as $string ) { var_dump( finfo_buffer( $finfo, $string, $option ) ); } - finfo_close( $finfo ); } ?> diff --git a/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt b/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt index f366972b613e1..a4d723f86c9ca 100644 --- a/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt +++ b/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt @@ -12,8 +12,6 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n"; var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) ); var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) ); -finfo_close( $finfo ); - // OO way $finfo = new finfo( FILEINFO_NONE, $magicFile ); var_dump( $finfo->set_flags( FILEINFO_MIME ) ); diff --git a/ext/fileinfo/tests/finfo_set_flags_basic.phpt b/ext/fileinfo/tests/finfo_set_flags_basic.phpt index 948031a0b8006..db71447ae2393 100644 --- a/ext/fileinfo/tests/finfo_set_flags_basic.phpt +++ b/ext/fileinfo/tests/finfo_set_flags_basic.phpt @@ -12,8 +12,6 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n"; var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) ); var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) ); -finfo_close( $finfo ); - // OO way $finfo = new finfo( FILEINFO_NONE, $magicFile ); var_dump( $finfo->set_flags( FILEINFO_MIME ) ); diff --git a/ext/fileinfo/tests/finfo_upstream.phpt b/ext/fileinfo/tests/finfo_upstream.phpt index ef5ec17b03706..2a28bd7f776c0 100644 --- a/ext/fileinfo/tests/finfo_upstream.phpt +++ b/ext/fileinfo/tests/finfo_upstream.phpt @@ -18,7 +18,6 @@ foreach($lst as $p) { if ($i !== $exp) { echo "'$p' failed\nexp: '$exp'\ngot: '$i'\n"; } - finfo_close($finfo); } echo "==DONE==";