Doc #69730 [Opn->Csd]: PDO: incorrect description of how to close the connection to the database

From: Date: Fri, 01 Jul 2016 09:13:09 +0000
Subject: Doc #69730 [Opn->Csd]: PDO: incorrect description of how to close the connection to the database
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13666@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69730&edit=1 ID: 69730 Updated by: cmb@php.net Reported by: 37xzxz at gmail dot com Summary: PDO: incorrect description of how to close the connection to the database -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: 5.6.9 Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. I have documented that *all* references to the PDO object have to be deleted, in order to close it. I have not documented the very issue described in this report, because that is a bug which already has been reported as bug #62847, and we usually don't document bugs. I'm leaving cappytoi's note in the manual until the bug is fixed, but going to remove Vicente's note as this doesn't add useful information. Note also, that there is alread request #62065 which suggests adding an explicit disconnect() method. Previous Comments: ------------------------------------------------------------------------ [2016-07-01 09:08:00] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339536 Log: Fix #69730: PDO: incorrect description of how to close the connection to the database ------------------------------------------------------------------------ [2016-07-01 08:08:52] cmb@php.net Related To: Bug #62065 ------------------------------------------------------------------------ [2015-05-29 15:56:27] 37xzxz at gmail dot com status update ------------------------------------------------------------------------ [2015-05-29 15:53:34] 37xzxz at gmail dot com I think documentation should be updated to actual state. cappytoi posted his note 1 year ago. I though that bug already exist somewhere here. But I failed to find it. I reproduced this issue on php-5.5.14-Win32-VC11-x86 and php-5.6.9-Win32-VC11-x86: I run php script and check MySQL using following query SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, LEFT(INFO, 51200) AS Info FROM information_schema.PROCESSLIST; I see connection from host with php script during 10 seconds. ------------------------------------------------------------------------ [2015-05-29 14:31:14] cmb@php.net Actually, cappytoi's note shouldn't be there at all. It is explained that bug reports & missing documentation shall not be posted as user contributed note, but rather a respective bug report should be filed[1]. I'm reluctant to reject the note now, as it already has been upvoted by a lot of users, so seems to be important. Anyhow, I'm neither able to reproduce the mentioned behavior of your test script with PHP 5.5.25 nor 5.6.9. I can, however, reproduce it with PHP 5.4.19. Did you really test this with PHP 5.6.9? If not, please do, and report back (don't forget to set the status of this ticket to "open" after doing so) – there may actually be a bug. Otherwise "only" the documentation would have to be improved. The respective statement is misleading at best: | To close the connection, you need to destroy the object by | ensuring that all remaining references to it are deleted--you do | this by assigning NULL to the variable that holds the object. Actually, assigning NULL to the variable that references the PDO instance will not close the connection, if there are still other references to this very instance (such as from a PDOStatement instance, or from other variables referencing the same PDO instance). These have to be removed also (for instance, by assigning NULL to the variable that references the PDOStatement). Of course, this can be automated by encapsulating the query execution in a function (or method for that matter), in which case the PDOStatement will be freed when the function returns. [1] <https://php.net/manual/add-note.php?sect=pdo.connections.php#whatnottoenter> ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=69730 -- Edit this bug report at https://bugs.php.net/bug.php?id=69730&edit=1

« previous php.doc.bugs (#13666) next »