I would argue we should discourage their use
(deprecation is my dream!)
I am with you on the deprecation of persistent connections, as the implementation is awkward, but not without addressing the use case.
As you well know, PDO is an object which also optionally uses PHP persistent resources to facilitate connection re-use across PHP requests, a feature which I don’t believe has a parallel in object space. Perhaps > > therein lies a feature request, i.e. to allow an object to be made persistent in the same way a resource can.
I floated the above idea. Any inclination that would be worth pursuing?
… would be an interface to declare the persistent connection as defunct, such that upon subsequent PDO creation, a new connection will be formed, and the former will be closed. This is distinct from a disconnect or > reconnect procedure, and similar to failing a “liveness” check upon persistent PDO creation. Users could then effectively replace their persistent PDO in the same manner they would do so for a “regular” PDO.
This idea is growing on me, to address the issue of a defunct persistent connection, rather than the disconnect() interface. Any thoughts on introducing a new attribute to the PDO constructor to prompt the reconnection: PDO::ATTR_PERSISTENT_RECONNECT.
-Robert