RE: External Message: Re: [PHP-DEV] [Discuss] Add PDO disconnect() and isConnected()

From: Date: Wed, 01 Oct 2025 16:42:30 +0000
Subject: RE: External Message: Re: [PHP-DEV] [Discuss] Add PDO disconnect() and isConnected()
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-128760@lists.php.net to get a copy of this message
> Database connections are full of state (apart from transactions, there are also > sql variables, temporary tables, and probably other stuff I am not aware of), > thus auto-reconnection cannot be transparent in the general case. In specific > scenarios, this is ok, but I doubt that it is best managed by a generic extension > like pdo. This is exactly why the ability to manually close the connection is badly needed. Just because a connection hasn't been lost doesn't mean it's in a usable state. PDO will happily hand you a reused connection that is not, in fact, still usable. The only way around this issue is to encapsulate PDO such that you can replace the useless instance with a new one, since you cannot currently close a connection that is in an error state. -Jeff

« previous php.internals (#128760) next »