From: thorsten at rinne dot info Operating system: Windows2000 PHP version: 4.3.3 PHP Bug Type: ODBC related Bug description: odbc_error() sometimes returns a bad string
Description: ------------ We use IBM DB2 databases on our Windows2000 systems. The bug occured then writing a database class. The odbc_error() function returns sometimes bad strings with special characters. If a real error occurs, the function returns the correct six-digit ODBC state. After that, the error code will not be removed from memory and the error code will be returned on every query although it is correct. Note: var_dump(odbc_error()) returns sometimes bad strings with special characters, sometimes nothing. Reproduce code: --------------- function myquery($query) { $result = odbc_exec($conn, $query); if (odbc_error($conn)) { print "SQLQuery: ".$query; print "ErrorNum: ".odbc_error($conn)); print "ErrorMsg: ".odbc_errormsg($conn)); } return $result; } Expected result: ---------------- The expected result should be empty when no error occured and the six-digit ODBC state when an error occured. After every correct new query, the result should be empty. Actual result: -------------- Here are some results, the queries are correct: SQLQuery: SELECT * FROM SYSTEM ErrorNum: 8¸ÌP· ErrorMsg: Ìx¹Ì or SQLQuery: SELECT * FROM SYSTEM2 ErrorNum: àWPW ErrorMsg: or SQLQuery: SELECT * FROM SYSTEM ErrorNum: ErrorMsg: -- Edit bug report at http://bugs.php.net/?id=25917&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25917&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25917&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25917&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25917&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25917&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25917&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25917&r=support Expected behavior: http://bugs.php.net/fix.php?id=25917&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25917&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25917&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25917&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25917&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25917&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25917&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25917&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25917&r=float