[php-src] master: ext/session: remove dead !O_NOFOLLOW fallback (#24291)

From: Date: Tue, 13 Oct 2026 14:53:03 +0000
Subject: [php-src] master: ext/session: remove dead !O_NOFOLLOW fallback (#24291)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142226@lists.php.net to get a copy of this message
Author: Jorg Adam Sowa (jorgsowa) Committer: GitHub (web-flow) Pusher: jorgsowa Date: 2026-10-13T16:52:59+02:00 Commit: https://github.com/php/php-src/commit/59b790a54ac1b651c49e082f7f52c50ace5fe8a7 Raw diff: https://github.com/php/php-src/commit/59b790a54ac1b651c49e082f7f52c50ace5fe8a7.diff ext/session: remove dead !O_NOFOLLOW fallback (#24291) Changed paths: M ext/session/mod_files.c Diff: diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 12205a1bc442..7c247b906877 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -149,7 +149,7 @@ static void ps_files_close(ps_files *data) static void ps_files_open(ps_files *data, /* const */ zend_string *key) { char buf[MAXPATHLEN]; -#if !defined(O_NOFOLLOW) || !defined(PHP_WIN32) +#ifndef PHP_WIN32 struct stat sbuf = {0}; #endif int ret; @@ -175,16 +175,7 @@ static void ps_files_open(ps_files *data, /* const */ zend_string *key) data->last_key = zend_string_copy(key); /* O_NOFOLLOW to prevent us from following evil symlinks */ -#ifdef O_NOFOLLOW data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW, data->filemode); -#else - /* Check to make sure that the opened file is not outside of allowable dirs. - This is not 100% safe but it's hard to do something better without O_NOFOLLOW */ - if (PG(open_basedir) && lstat(buf, &sbuf) == 0 && S_ISLNK(sbuf.st_mode) && php_check_open_basedir(buf)) { - return; - } - data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY, data->filemode); -#endif if (data->fd != -1) { #ifndef PHP_WIN32

« previous php.cvs (#142226) next »