Skip to content

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

Open
lacatoire wants to merge 1 commit into
php:PHP-8.4from
lacatoire:fix/posix-access-empty-filename-PHP-8.4
Open

lacatoire wants to merge 1 commit into
php:PHP-8.4from
lacatoire:fix/posix-access-empty-filename-PHP-8.4

Conversation

@lacatoire

@lacatoire lacatoire commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

posix_access("") returns false with EIO, while posix_eaccess() and posix_pathconf() throw a ValueError for the same input. Check for an empty filename up front and throw the same ValueError.

To reproduce

var_dump(posix_access(""));
var_dump(posix_get_last_error());

PHP 8.4.26

Before: bool(false) then int(5)

After: ValueError: posix_access(): Argument #1 ($filename) must not be empty

posix_access("") returned false with EIO because expand_filepath()
fails on an empty string, while posix_eaccess() and posix_pathconf()
throw a ValueError for the same input.

Check for an empty filename up front and throw the same ValueError.
Over-long paths still return false, as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants