From: wkonkel at mindshare dot net Operating system: FreeBSD PHP version: 4.3.10 PHP Bug Type: MySQL related Bug description: mysql_error doesn't work correctly with two mysql_connects
Description: ------------ I have found the same problem as this bogus bug (it's not bogus though): http://bugs.php.net/bug.php?id=26114 This is still an issue in 4.3.10 and is not bogus. You cannot pass $link2 as a parameter to mysql_error becuase upon a failed connection, $link2 is false. How do you get the errno/error? Reproduce code: --------------- Scenario 1: $link1 = @mysql_connect("localhost","user","pass"); $link2 = @mysql_connect("blah","user","pass") or die("error: " . mysql_errno() . " -- " . mysql_error()); Scenario 2: //$link1 = @mysql_connect("localhost","user","pass"); $link2 = @mysql_connect("blah","user","pass") or die("error: " . mysql_errno() . " -- " . mysql_error()); Expected result: ---------------- Scenario 1: error: 2005 -- Lost connection to MySQL server during query Scenario 2: error: 2005 -- Lost connection to MySQL server during query Actual result: -------------- Scenario 1: error: 0 -- Scenario 2: error: 2005 -- Lost connection to MySQL server during query -- Edit bug report at http://bugs.php.net/?id=32798&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32798&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32798&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32798&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32798&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32798&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32798&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32798&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32798&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32798&r=support Expected behavior: http://bugs.php.net/fix.php?id=32798&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32798&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32798&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32798&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32798&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32798&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32798&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32798&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32798&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32798&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32798&r=mysqlcfg
