From: memso at memso dot net Operating system: Windows 2003 Server PHP version: 5.2.3 PHP Bug Type: MSSQL related Bug description: Multiple Connections to the same Server and Login Override Previous Connections
Description: ------------ After creating a MSSQL connection, any subsequent connections to MSSQL, whether persistant or otherwise, using the same server and login information, will override the original MSSQL connection. Using two different logins do not cause the problem. This has been tested and found to occur in PHP 5.2.0 and 5.2.3 for Windows (Windows 2003 Server) as well as PHP 5.2.3 for Linux (a heavily customized v2.2.24). This is very similar to Bug #17305. Reproduce code: --------------- $testquery = "SELECT EMAILADDRESS FROM adminmain WHERE ID = 1"; $conn1 = mssql_connect("localhost", "sa", "********"); mssql_select_db("generic", $conn1); // First Query! $result = mssql_query($testquery, $conn1); $qarray = mssql_fetch_array($result); echo("First Result: " . $qarray["EMAILADDRESS"] . "<br />"); $conn2 = mssql_connect("localhost", "sa", "********"); mssql_select_db("buymanitou", $conn2); // Second Query! // NOTE THAT THIS IS ON CONN1 AGAIN! $result = mssql_query($testquery, $conn1); $qarray = mssql_fetch_array($result); echo("Second Result: " . $qarray["EMAILADDRESS"] . "<br />"); mssql_close($conn1); mssql_close($conn2); Expected result: ---------------- In my test case, I am grabbing an email address from the first administrator in the system from the first database connection. Since in my case, the first DB connection returns [EMAIL PROTECTED] , I expect the following output: First Result: [EMAIL PROTECTED] Second Result: [EMAIL PROTECTED] Actual result: -------------- Because of the bug, the email address from the SECOND database is returned for the second query: First Result: [EMAIL PROTECTED] Second Result: [EMAIL PROTECTED] -- Edit bug report at http://bugs.php.net/?id=42392&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42392&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42392&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42392&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42392&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42392&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42392&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42392&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42392&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42392&r=support Expected behavior: http://bugs.php.net/fix.php?id=42392&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42392&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42392&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42392&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42392&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42392&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42392&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42392&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42392&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42392&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42392&r=mysqlcfg