Bug #18292: mysql_close($link) close all connections

From: Date: Fri, 12 Jul 2002 05:53:11 +0000
Subject: Bug #18292: mysql_close($link) close all connections
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13909@lists.php.net to get a copy of this message
From: Beater@orgalan.de Operating system: Windows 2000 PHP version: 4.2.1 PHP Bug Type: MySQL related Bug description: mysql_close($link) close all connections <?php function test() { $link2 = mysql_connect('localhost', 'phpde', 'phpde'); var_dump($link2); echo mysql_error(); mysql_select_db('ratbytes', $link2); echo mysql_error(); $result = mysql_query('SELECT * FROM rb_user', $link2); echo mysql_error(); mysql_fetch_array($result); echo mysql_error(); mysql_close($link2); echo mysql_error(); } $link = mysql_connect('localhost', 'phpde', 'phpde'); var_dump($link); echo mysql_error(); mysql_select_db('ratbytes', $link); echo mysql_error(); test(); $result = mysql_query('SELECT * FROM rb_user', $link); echo mysql_error(); mysql_fetch_array($result); echo mysql_error(); mysql_close($link); echo mysql_error(); ?> produced following output: resource(1) of type (mysql link) resource(1) of type (mysql link) Warning: mysql_query(): 1 is not a valid MySQL-Link resource in ....test.php on line 25 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ....test.php on line 27 Warning: mysql_close(): 1 is not a valid MySQL-Link resource in ....test.php on line 29 ... works fine if no link_identifier is specified (mysql_close) <?php $link = mysql_connect('localhost', 'phpde', 'phpde'); var_dump($link); echo mysql_error(); mysql_select_db('ratbytes', $link); echo mysql_error(); // start inline $link2 = mysql_connect('localhost', 'phpde', 'phpde'); var_dump($link2); echo mysql_error(); mysql_select_db('ratbytes', $link2); echo mysql_error(); $result = mysql_query('SELECT * FROM rb_user', $link2); echo mysql_error(); mysql_fetch_array($result); echo mysql_error(); mysql_close($link2); echo mysql_error(); // end inline $result = mysql_query('SELECT * FROM rb_user', $link); echo mysql_error(); mysql_fetch_array($result); echo mysql_error(); mysql_close($link); echo mysql_error(); ?> produced following output: resource(1) of type (mysql link) resource(1) of type (mysql link) -- Edit bug report at http://bugs.php.net/?id=18292&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18292&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18292&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18292&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18292&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18292&r=support Expected behavior: http://bugs.php.net/fix.php?id=18292&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18292&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18292&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18292&r=globals

« previous php.bugs (#13909) next »