[php-src] PHP-8.6: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Weilin Du | Date: | Thu, 19 Nov 2026 20:12:29 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143932@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-11-20T04:05:44+08:00
Commit: https://github.com/php/php-src/commit/e0bc278c889fe1161f7660d8d5969b286a706b91
Raw diff: https://github.com/php/php-src/commit/e0bc278c889fe1161f7660d8d5969b286a706b91.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
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 15520093cd79..1bc0372d019e 100644
--- a/NEWS
+++ b/NEWS
@@ -113,6 +113,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 a0159934ae9e..c0c45f174128 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -745,6 +745,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