[php-src] PR #21857: feat(mysqlnd): send COM_RESET_CONNECTION in restart_psession

From: Date: Thu, 23 Apr 2026 19:37:40 +0000
Subject: [php-src] PR #21857: feat(mysqlnd): send COM_RESET_CONNECTION in restart_psession
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-35871@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/21857 Author: ericnorris Closes #20225. I'm not sure if adding this to PDO is a step too far; we could limit this to just mysqlnd if necessary. Disclosure: I've used Claude to write the commit (the commit message is mostly mine), but take full responsibility for the changes and have reviewed it to the best of my ability. --- Before this commit, persistent MySQL connection reuse relied on COM_CHANGE_USER to reset server-side session state in mysqli. PDO MySQL did not reset server-side state at all, it only pinged to check liveness, leaving user variables, temporary tables, and transaction state from previous requests intact. After this commit, both mysqli and PDO MySQL send COM_RESET_CONNECTION when reusing a persistent connection, which resets all server-side session state without re-authentication. We've implemented this by adding a reset_connection command to mysqlnd's command layer. It's similar to the existing ping command, since there's no payload. We now call it from restart_psession, which we've also changed to return enum_func_status so callers can handle failures. In mysqli, we've replaced the COM_CHANGE_USER call in the persistent reuse path with a call to restart_psession. In PDO MySQL, we've replaced the mysql_ping in check_liveness with a call to restart_psession, which both verifies the connection is alive and resets session state in a single round trip. We've also removed a call to restart_psession on unconnected handles during initialization.

« previous php.git-pulls (#35871) next »