|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29522 properties of mysqli (class) aren't accessable if db connection already closed
Submitted: 2004-08-04 13:44 UTC Modified: 2004-08-04 15:03 UTC
From: Nico dot Laus dot 2001 at gmx dot de Assigned: georg
Status: Closed Package: MySQL related
PHP Version: 5.0.0 OS: Linux 2.6.7
Private report: No CVE-ID:
 [2004-08-04 13:44 UTC] Nico dot Laus dot 2001 at gmx dot de
when closing the connection to the db, and using 
properties of the $mysqli object (such as insert_id), PHP 
crashes (or even the webserver, I don't know) 
-> although closing it before is not the right way, at 
least an error message should be displayed 
(took me a while to recognize that 1. some properties are 
not accessible after disconnecting and 2. that this was 
the reason for not showing the whole page) 

Reproduce code:
// taken from

$mysqli = new mysqli('HOST', 'USER', 'PASSWORD','DB');
$mysqli->query("CREATE TABLE myCity LIKE City");
$query = "INSERT INTO myCity VALUES (NULL, 'Stuttgart', 'DEU', 'Stuttgart', 617000)";

/* close connection */

printf ("New Record has id %d.\n", $mysqli->insert_id);

Expected result:
print out "New Record has id <id>" 

Actual result:
"connection to <server> broken" error message from the 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-04 15:03 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 18:01:33 2015 UTC