From: lars dot roessiger at gmail dot com Operating system: Windows Server 2003 PHP version: 5.2.0 PHP Bug Type: MSSQL related Bug description: Connection problems after SQL error
Description: ------------ Unexpected behaviour when SQL queries fail. Reproduce code: --------------- <? $db_host = ""; $db_user = ""; $db_pass = ""; $db_base = ""; function error_handler($errno, $errmsg) { echo $errmsg; exit(1); } // script will hang on sql error $dbconn = mssql_connect($db_host, $db_user, $db_pass); // refreshes will cause sql server to refuse selection of db //$dbconn = mssql_pconnect($db_host, $db_user, $db_pass); mssql_select_db($db_base, $dbconn); error_reporting(0); set_error_handler("error_handler"); if($_GET['error'] == "plain") trigger_error("Error", E_USER_ERROR); // produce error else if($_GET['error'] == "sql") mssql_query("SELECT asdf FROM asdf"); // produce sql error ?> Expected result: ---------------- mssql_connect(): On SQL error the script should not hang but finish. mssql_pconnect(): On SQL error further connection requests should not fail. Actual result: -------------- If an SQL error occurs, database connections established with mssql_pconnect() get lost. New connection requests fail with "mssql_select_db() [function.mssql-select-db]: Unable to select database". When using mssql_connect() instead of mssql_pconnect(), execution of the resp. PHP script will hang (up to 5 minutes). The error handler will finish its job, but PHP does not close the connection to the browser - it keeps "loading" (although no data is being sent anymore). -- Edit bug report at http://bugs.php.net/?id=39582&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39582&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39582&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39582&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39582&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39582&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39582&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39582&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39582&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39582&r=support Expected behavior: http://bugs.php.net/fix.php?id=39582&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39582&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39582&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39582&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39582&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39582&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39582&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39582&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39582&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39582&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39582&r=mysqlcfg