> This sounds better, but I would argue that if it's a PERSISTENT > connection, then it should be impossible for the user to close it. The > idea is that the connection should remain open after being established > and should only close when the server restarts.
I think this reads too much into the "persistent" language, which does not derive from PDO but rather PHP resources. PDO cannot guarantee a connection always be open, nor should it be defining what connection viability is - it's an application-level concern, and an overreach. > What scenario would necessitate the user to close a connection that should never close? I provided some examples in the thread as to why a user could want to close a connection, maybe unconvincingly. > What I am trying to say is that there should be no need to ever close > a persistent connection. If it ever gets messed up, it should be > restored to the working state rather than being closed. Thinking along these lines, what could meet this objective and satisfy some of the concerns outlined here, 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. Difficulties in unset($pdo) to force a disconnect are still present though perhaps can be mitigated with the refactoring efforts outlined in "Future Scope" to break apart the mutual PDO and PDO statement references.
