#33302 [Fbk->Opn]: SQL Query in custom error handler is executed twice
| From: | a dot bendilas at zefxis dot gr | Date: | Mon, 13 Jun 2005 07:53:01 +0000 |
| Subject: | #33302 [Fbk->Opn]: SQL Query in custom error handler is executed twice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80211@lists.php.net to get a copy of this message | ||
ID: 33302
User updated by: a dot bendilas at zefxis dot gr
Reported By: a dot bendilas at zefxis dot gr
-Status: Feedback
+Status: Open
Bug Type: Scripting Engine problem
Operating System: Win XP
PHP Version: 5.0.4
New Comment:
I'm afraid this didn't solve the issue.
Previous Comments:
------------------------------------------------------------------------
[2005-06-11 15:30:04] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-06-10 16:22:38] a dot bendilas at zefxis dot gr
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 this bug report at http://bugs.php.net/?id=33302&edit=1