php.net |  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 (profile)
Status: Closed Package: MySQL related
PHP Version: 5.0.0 OS: Linux 2.6.7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Nico dot Laus dot 2001 at gmx dot de
New email:
PHP Version: OS:

 

 [2004-08-04 13:44 UTC] Nico dot Laus dot 2001 at gmx dot de
Description:
------------
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 http://de2.php.net/manual/en/function.mysqli-insert-id.php

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

/* close connection */
$mysqli->close(); 

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 
browser 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-04 15:03 UTC] georg@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC