[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Weilin Du | Date: | Thu, 19 Nov 2026 20:12:29 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143930@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-11-20T04:06:06+08:00
Commit: https://github.com/php/php-src/commit/925d7e3dc04205e80e99e1e0a48b6dd9c1616d62
Raw diff: https://github.com/php/php-src/commit/925d7e3dc04205e80e99e1e0a48b6dd9c1616d62.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Throw ValueError for empty filename in posix_access() (#25589)
Changed paths:
A ext/posix/tests/posix_access_empty_filename.phpt
M NEWS
M ext/posix/posix.c
Diff:
diff --git a/NEWS b/NEWS
index 6a5691dac42a..ed97fe60fceb 100644
--- a/NEWS
+++ b/NEWS
@@ -136,6 +136,8 @@ PHP NEWS
- POSIX:
. Fixed bug GH-25530 (posix_get_last_error() returns an error from a
previous request). (Artem Ukrainskiy)
+ . Fixed posix_access() returning false for an empty filename instead of
+ throwing a ValueError (GH-25589). (lacatoire)
- Readline:
. Fixed incorrect handling of non-ASCII pending_input bytes in readline_info(),
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 856cb7888023..731a13310fc4 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -743,6 +743,11 @@ PHP_FUNCTION(posix_access)
Z_PARAM_LONG(mode)
ZEND_PARSE_PARAMETERS_END();
+ if (filename_len == 0) {
+ zend_argument_must_not_be_empty_error(1);
+ RETURN_THROWS();
+ }
+
path = expand_filepath(filename, NULL);
if (!path) {
POSIX_G(last_error) = EIO;
diff --git a/ext/posix/tests/posix_access_empty_filename.phpt
b/ext/posix/tests/posix_access_empty_filename.phpt
new file mode 100644
index 000000000000..93154fe8d396
--- /dev/null
+++ b/ext/posix/tests/posix_access_empty_filename.phpt
@@ -0,0 +1,14 @@
+--TEST--
+posix_access(): empty filename throws a ValueError
+--EXTENSIONS--
+posix
+--FILE--
+<?php
+try {
+ posix_access("");
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+posix_access(): Argument #1 ($filename) must not be empty