[php-src] PR #22753: Fix GH-22631: ext/mysqli: fix corruption of num_active_persistent when using real_connect
| From: | bavis-m | Date: | Wed, 15 Jul 2026 19:16:13 +0000 |
| Subject: | [php-src] PR #22753: Fix GH-22631: ext/mysqli: fix corruption of num_active_persistent when using real_connect | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37080@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22753
Author: bavis-m
Fix GH-22631: ext/mysqli: mysqli double increments num_active_persistent...
In mysqli_common_connect(), when is_real_connect is set and a persistent connection is requested,
both the persistent connection branch and the normal function flow (in the end: label) increment the
num_active_persistent counter. num_active_persistent is also decremented once as a result of
cleaning up old persistent connection state, but this still results in the counter growing by 1
every time we reuse an existing connection, and becoming invalid. This can cause later non-cached
persistent connection attempts to fail the max_persistent limit check, depsite there not actually
being that many persistent connections.
This commit adds a flag from_pool which is set when a connection is found in the persistent
connection pool, and which prevents the counter increment in the end: label from firing.
Fixes GH-22631