From: dan at novapulsar dot com Operating system: centos4.3 PHP version: 4.4.7 PHP Bug Type: MySQL related Bug description: mysql_error doesn't return a string, just dumps output to screen
Description: ------------ Since mysql_error() is documented to 'return' a string, I assumed it would be safe to put it in either a string, or as an argument to an error handling function. Reproduce code: --------------- function fn_Save_Error ($x_page_url, $x_error) { if (strlen($x_page_url) && strlen($x_error)) { //output if debugging is on echo ("Error on page: " . $x_page_url . " -> " . $x_error); //save to db } } $strSQL = "select all from something will make an error duh"; $objResult = mysql_query ($strSQL) or die (fn_Save_Error('this.php', mysql_error()); Expected result: ---------------- Expected result is that the string value of mysql_error() is passed as an argument of datatype string whether blank or with contents to the fn_Save_Error function. Actual result: -------------- Mysql_error() is output directly to the screen/console, instead of being passed as a value to fn_Save_Error for custom error handling. Based on the mysql_error() documentation it should not output the error to screen, it should return it as a string, so that I could do this: ...some wrong query execution... $error_message = mysql_error(); echo ($error_message); $error_message should be == to $mysql_error, but instead it just outputs to screen/console -- Edit bug report at http://bugs.php.net/?id=41910&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41910&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41910&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41910&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41910&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41910&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41910&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41910&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41910&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41910&r=support Expected behavior: http://bugs.php.net/fix.php?id=41910&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41910&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41910&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41910&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41910&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41910&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41910&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41910&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41910&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41910&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41910&r=mysqlcfg