#33302 [NEW]: SQL Query in custom error handler is executed twice
| From: | a dot bendilas at zefxis dot gr | Date: | Fri, 10 Jun 2005 14:22:38 +0000 |
| Subject: | #33302 [NEW]: SQL Query in custom error handler is executed twice | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-80128@lists.php.net to get a copy of this message | ||
From: a dot bendilas at zefxis dot gr
Operating system: Win XP
PHP version: 5.0.4
PHP Bug Type: Unknown/Other Function
Bug description: SQL Query in custom error handler is executed twice
Description:
------------
There seems to be a strange behaviour when it comes to the execution of a
custom error handler.Particularly, a query is executed twice, but the
rest of the code only once.
Reproduce code:
---------------
set_error_handler("user_error_handler");
function user_error_handler($severity, $msg, $filename, $linenum,$content)
{
if ($severity & E_STRICT){
return;
}
else{
$errorMsg ='There was an error';
echo 'test';
$link = mysql_connect('localhost', 'root', 'password');
$db_selected = mysql_select_db('db', $link);
$sql = "INSERT INTO Errors
(ErrorMsg
,DateCreated) VALUES (
'".$errorMsg."'
,NOW()
)";
$results = mysql_query($sql);
die;
}
}
echo s;
Expected result:
----------------
The query should run once and 'test' should appear on the screen
Actual result:
--------------
The query is executed twice and 'test' appears only once on the screen
--
Edit bug report at http://bugs.php.net/?id=33302&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33302&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33302&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33302&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33302&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33302&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33302&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33302&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33302&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33302&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33302&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33302&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33302&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33302&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33302&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33302&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33302&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33302&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33302&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33302&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33302&r=mysqlcfg