[php-src] master: ext/posix: revert posix_access() flags validation. (#23710)

From: Date: Thu, 17 Sep 2026 07:18:53 +0000
Subject: [php-src] master: ext/posix: revert posix_access() flags validation. (#23710)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141248@lists.php.net to get a copy of this message
Author: David CARLIER (devnexen) Committer: GitHub (web-flow) Pusher: devnexen Date: 2026-09-17T08:18:51+01:00 Commit: https://github.com/php/php-src/commit/fca72841a5d41b11c0e60ed0906af6af302741ca Raw diff: https://github.com/php/php-src/commit/fca72841a5d41b11c0e60ed0906af6af302741ca.diff ext/posix: revert posix_access() flags validation. (#23710) The check rejected flag values that access() itself accepts, and the posix_mkfifo() counterpart was already reverted, leaving both UPGRADING notes describing behaviour that no longer exists. Dropped the remaining check along with its test and the two UPGRADING entries. Changed paths: D ext/posix/tests/posix_access_flags.phpt M NEWS M UPGRADING M ext/posix/posix.c Diff: diff --git a/NEWS b/NEWS index 94fe95513340..6a0aa043a5e1 100644 --- a/NEWS +++ b/NEWS @@ -45,6 +45,10 @@ PHP NEWS - PGSQL: . Fixed pg_lo_write() rejecting data containing null bytes. (Ilia Alshanetsky) +- Posix: + . Reverted the validity check on the flags argument of posix_access(). + (David Carlier) + - SPL: . Fixed bug GH-23385 (SplDoublyLinkedList::serialize() use-after-free when __serialize() removes an element). (David Carlier) diff --git a/UPGRADING b/UPGRADING index 4836c26a2870..2d1ecc641668 100644 --- a/UPGRADING +++ b/UPGRADING @@ -130,12 +130,6 @@ PHP 8.6 UPGRADE NOTES paths. Previously, it could occur in a directory name or as part of an extension such as ".pharma". -- Posix: - . posix_access() now raises a ValueError when an invalid $flags - argument value is passed. - . posix_mkfifo() now raises a ValueError when an invalid $permissions - argument value is passed. - - Session: . Setting session.cookie_path, session.cookie_domain, or session.cache_limiter to a value containing NUL bytes now emits a warning and leaves the setting diff --git a/ext/posix/posix.c b/ext/posix/posix.c index a9fe723f454b..049d0bfdf19c 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -746,15 +746,6 @@ PHP_FUNCTION(posix_access) RETURN_FALSE; } - if (mode < 0 || (mode & ~(F_OK | R_OK | W_OK | X_OK))) { - zend_argument_value_error( - 2, - "must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK" - ); - efree(path); - RETURN_THROWS(); - } - ret = access(path, mode); efree(path); diff --git a/ext/posix/tests/posix_access_flags.phpt b/ext/posix/tests/posix_access_flags.phpt deleted file mode 100644 index ba2104e6dc1f..000000000000 --- a/ext/posix/tests/posix_access_flags.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -posix_access() flag (mode) validation ---SKIPIF-- -<?php -if (!function_exists("posix_access")) { - die("skip no posix_access()"); -} -?> ---FILE-- -<?php - -$dir = __DIR__; -$testfile = "$dir/testfile.txt"; - -// Create a temporary file for valid access tests -file_put_contents($testfile, "hello"); - -try { - posix_access($testfile, -1); -} catch (ValueError $e) { - echo $e::class, ': ', $e->getMessage(), "\n"; -} - -try { - posix_access($testfile, 01000); // S_ISVTX bit (sticky) -} catch (ValueError $e) { - echo $e::class, ': ', $e->getMessage(), "\n"; -} - -try { - posix_access($testfile, 02000); // S_ISGID bit -} catch (ValueError $e) { - echo $e::class, ': ', $e->getMessage(), "\n"; -} - -if (posix_access($testfile, POSIX_R_OK | POSIX_W_OK)) { - echo "Read/write access OK\n"; -} - -if (posix_access($testfile, POSIX_F_OK)) { - echo "File exists OK\n"; -} - -?> ---CLEAN-- -<?php -@unlink(__DIR__ . '/testfile.txt'); -?> ---EXPECTF-- -ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK -ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK -ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK -Read/write access OK -File exists OK

« previous php.cvs (#141248) next »