[php-src] master: Merge branch 'PHP-8.6'
| From: | Weilin Du | Date: | Thu, 19 Nov 2026 20:12:32 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143931@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-11-20T04:06:39+08:00
Commit: https://github.com/php/php-src/commit/39ce9f5b64d6480c9262f8312631cb493af03210
Raw diff: https://github.com/php/php-src/commit/39ce9f5b64d6480c9262f8312631cb493af03210.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Throw ValueError for empty filename in posix_access() (#25589)
Changed paths:
A ext/posix/tests/posix_access_empty_filename.phpt
M ext/posix/posix.c
Diff:
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 78ffbe5a2875..3e7eff085c2d 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