Req #67473 [NEW]: Expose close connection feature

From: Date: Thu, 19 Jun 2014 08:35:50 +0000
Subject: Req #67473 [NEW]: Expose close connection feature
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186249@lists.php.net to get a copy of this message
From: galinoo at yahoo dot fr Operating system: PHP version: 5.4.29 Package: PDO related Bug Type: Feature/Change Request Bug description:Expose close connection feature Description: ------------ The PDO class actually doesn't expose any method to manually close openened connections (with the PDO constructor). Please note that the documentation (http://fr2.php.net/manual/en/pdo.connections.php) is not clear about this, and just states setting the variable holding the PDO reference is enough to close the connection ($pdo = NULL). This sentence is FALSE, and, unfortunately, its real signification is not understandable for PHP newbies, and people would don't really know what it means setting a variable to NULL in PHP (ref count). In fact, what it means is that references count is used to determine automatically when a connection must be closed: this is an incomplete and unflexible feature. Many use cases can be found, where one opens a connection, and closes it by hand, when the 'stuff' is done, without waiting for the references count to be 0 or the end of the script. For instance, imagine you're working with a framework able to provide the connection instance, and the instance is holded in many variables, or you're writing a test case, and as you 'setUp' resources, you must also close them during 'tearDown'. You must set all variables to null, but there may be in independent software modules. How to do that? PDO MUST provide a way to manually close the connection it opens under the hood, for instance a 'close' method in the PDO class shall do the job. Thanks for your consideration, and your work! BR -- Edit bug report at https://bugs.php.net/bug.php?id=67473&edit=1 --

« previous php.bugs (#186249) next »