Commit 23c668a7125 for php

commit 23c668a71251a0dc88acad6b50288b65524c99bb
Author: lacatoire <la.catoire@gmail.com>
Date:   Thu Oct 1 15:24:45 2026 +0200

    Throw ValueError for empty filename in posix_access() (#25589)

    An empty filename makes expand_filepath() fail, so posix_access() used
    to return false and set EIO. Reject the empty filename before expanding
    the path so it throws the same ValueError as posix_eaccess() and
    posix_pathconf(). Overlong paths still return false.

    Closes #25589

diff --git a/NEWS b/NEWS
index d5aa3407361..5593b4ce2ac 100644
--- a/NEWS
+++ b/NEWS
@@ -115,6 +115,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 536c9009326..3522abe0af2 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -725,6 +725,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 00000000000..93154fe8d39
--- /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