From:             Nico dot Laus dot 2001 at gmx dot de
Operating system: Linux 2.6.7
PHP version:      5.0.0
PHP Bug Type:     MySQL related
Bug description:  properties of mysqli (class) aren't accessable if db connection 
already closed

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 

-- 
Edit bug report at http://bugs.php.net/?id=29522&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29522&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29522&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29522&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29522&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29522&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29522&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29522&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29522&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29522&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29522&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29522&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29522&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29522&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29522&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29522&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29522&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29522&r=float

Reply via email to