Hi, list! This is my first email to this mailing list, so please pardon me for misuse of the traditions you may have here (formatting, phrasing, etc.).
Maybe this has been discussed in depth earlier, but: I want to ask if there is an explicit reason for not giving a "close" instance method in the PDO class. The Web is full of wrong disputes about why one would want to explicitly close a PDO connection, since it is auto-released at end of script life-cycle. Of course this is wrong, because among many other use cases, for example a long running script (daemon-like) may want to free a DB Connection slot when they know they have to sleep for some time. The manual says that one has to assign to null, the variable retaining the PDO instance. One also has to null out all the variables holding a statement coming from that PDO instance). IMHO this is not good practice enough, especially given the way many PHP developers (mis)understand reference counting and variables. $a = new PDO(...); $b = $a; $a = null; This above snippet will not close the connection when assigning $a = null; (at list not until PHP 5.6 incl). In an application made of dependency injection, closures and many levels of function calls split over many files, it is virtually impossible to keep reference counting mentally, and you mostly end up never knowing what other component of the application still retains a reference to the PDO object. And yet, in some use cases, you still know that you want to release the connection before going to sleep or doing a lengthy operation (which might anyway cause a "Sql server has gone away", so you're better off not occupying a DBMS connection slot for nothing during the lengthy operation. I think it could be recommended to export a "closeConnection" method. I would be happy to know what people think (and pardon me again if the debate has been conducted already : please guide me to the corresponding literature?) If it is of any interest, what would be the next step? For me to open an RFC? Thanks, Regards, Gabriel