php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33302 SQL Query in custom error handler is executed twice
Submitted: 2005-06-10 16:22 UTC Modified: 2005-06-21 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: a dot bendilas at zefxis dot gr Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.4 OS: Win XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-06-10 16:22 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-11 15:30 UTC] 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-13 09:52 UTC] a dot bendilas at zefxis dot gr
I'm afraid this didn't solve the issue.
 [2005-06-13 10:25 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2005-06-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 06:01:31 2024 UTC