[php-src] PR #25532: Fix GH-25530: posix_get_last_error() and socket_last_error() return errors from a previous request
| From: | ArtUkrainskiy | Date: | Tue, 17 Nov 2026 18:36:51 +0000 |
| Subject: | [php-src] PR #25532: Fix GH-25530: posix_get_last_error() and socket_last_error() return errors from a previous request | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40742@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25532
Author: ArtUkrainskiy
Fixes GH-25530
When one process or thread serves several requests, as with php-fpm,
posix_get_last_error() and socket_last_error() without a socket can return
an error left by an earlier request. POSIX_G(last_error) and
SOCKETS_G(last_error) hold the errno of the last posix or socket call that set one.
They are set to 0 in GINIT and aren't cleared when a request ends. This clears both in
RSHUTDOWN.
Each test makes a failing call in one request to the CLI server and reads the error in the next one.
Both tests fail without the fix. I also checked php-fpm with one worker. ext/posix and ext/sockets
have no new test failures, also with ASan and ZTS. Only mcast_ipv6_recv.phpt fails on
my machine, with and without the fix. The code change applies cleanly to 8.5, 8.6 and master.