[php-src] PR #24310: Fix GH-24308: Request shutdown closes a syslog handle PHP did not open
| From: | lazerg | Date: | Wed, 14 Oct 2026 00:56:44 +0000 |
| Subject: | [php-src] PR #24310: Fix GH-24308: Request shutdown closes a syslog handle PHP did not open | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39400@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24310
Author: lazerg
The syslog RSHUTDOWN handler called
php_closelog() after every request, even when
nothing in the request had opened syslog. In an embedded SAPI, a host that called
openlog() before running PHP lost its connection when each request ended. PHP already
tracks this in PG(have_called_openlog), so the handler now checks it first. Requests
that open syslog through openlog() or error_log = syslog still close it at
the end.
I checked it with an embed host on Debian (glibc). The host opens syslog with
LOG_NDELAY and runs three requests that do not touch syslog. Before the fix, strace
shows four connects to /dev/log. After the fix, it shows one. There is no test, because
run-tests has no way to drive the embed SAPI with a host-owned handle.
Fixes GH-24308