[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Ilia Alshanetsky | Date: | Fri, 27 Nov 2026 10:43:52 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144259@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-11-27T05:38:08-05:00
Commit: https://github.com/php/php-src/commit/3b71de12ef269717e0a8d7e158728db370d6b0d1
Raw diff: https://github.com/php/php-src/commit/3b71de12ef269717e0a8d7e158728db370d6b0d1.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
ext/bz2: Fix NULL dereference when compress.bzip2:// open fails in write mode
Changed paths:
A ext/bz2/tests/dba_opened_path_null.phpt
M ext/bz2/bz2.c
Diff:
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c
index dd1b87d2bf61..626c2e856848 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.c
@@ -253,7 +253,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
/* remove the file created by php_stream_open_wrapper(), it is not needed since BZ2 functions
* failed.
*/
- if (opened_path && !bz_file && mode[0] == 'w') {
+ if (opened_path && *opened_path && !bz_file && mode[0] == 'w')
{
VCWD_UNLINK(ZSTR_VAL(*opened_path));
}
}
diff --git a/ext/bz2/tests/dba_opened_path_null.phpt b/ext/bz2/tests/dba_opened_path_null.phpt
new file mode 100644
index 000000000000..d73730a58dc8
--- /dev/null
+++ b/ext/bz2/tests/dba_opened_path_null.phpt
@@ -0,0 +1,16 @@
+--TEST--
+compress.bzip2:// opener must not unlink a NULL opened_path when the open fails
+--EXTENSIONS--
+bz2
+dba
+--SKIPIF--
+<?php
+if (!in_array('flatfile', dba_handlers())) die('skip flatfile handler not
available');
+?>
+--FILE--
+<?php
+var_dump(dba_open("compress.bzip2://" . __DIR__ . "/nonexistent-dir/x",
"nd", "flatfile"));
+?>
+--EXPECTF--
+Warning: dba_open(%S): Failed to open stream: operation failed in %s on line %d
+bool(false)