Req #67473 [Opn->Dup]: Expose close connection feature

From: Date: Mon, 29 Aug 2016 14:38:20 +0000
Subject: Req #67473 [Opn->Dup]: Expose close connection feature
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203654@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67473&edit=1 ID: 67473 Updated by: cmb@php.net Reported by: galinoo at yahoo dot fr Summary: Expose close connection feature -Status: Open +Status: Duplicate Type: Feature/Change Request Package: PDO related PHP Version: 5.4.29 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Duplicate of request #62065. Previous Comments: ------------------------------------------------------------------------ [2014-06-19 08:35:48] galinoo at yahoo dot fr 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 this bug report at https://bugs.php.net/bug.php?id=67473&edit=1

« previous php.bugs (#203654) next »