Edit report at https://bugs.php.net/bug.php?id=51487&edit=1

 ID:               51487
 Updated by:       php-bugs@lists.php.net
 Reported by:      fabien dot potencier at symfony-project dot org
 Summary:          set_error_handler() misbehave under certain
                   circumstancies
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          Scripting Engine problem
 Operating System: All
 PHP Version:      5.3.2

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2010-04-06 15:07:57] fabien dot potencier at symfony-project dot org

I have just tested with php5.3-201004061030, and the problem is not fixed.

The output is indeed better, as the line is not 0 anymore:

Call to a member function call() on a non-object in ... on line 9

instead of:

Call to a member function call() on a non-object in ... on line 0

------------------------------------------------------------------------
[2010-04-06 14:31:45] johan...@php.net

bug #51463 might be related, stas also worked on a similar bug where I don't 
find the commit or bug id right now. Could you pleasetest the latest snapshot, 
maybe this was fixed. Thanks.

------------------------------------------------------------------------
[2010-04-06 13:56:59] fabien dot potencier at symfony-project dot org

Description:
------------
When throwing an exception from a custom error handler, PHP sometimes dies with 
a non-obvious error as the actual problem is hidden.

To reproduce, create a simple set_error_handler() and throw an exception 
(ErrorException here) whenever an error occur (with error_reporting set to -1 
for instance).

If you try to output a not-defined variable, you will see the Exception. But, 
if you call a method on a not-defined variable, the exception is not thrown, 
and an error message is displayed instead. Debugging is not trivial as the real 
problem is masked.


Test script:
---------------
set_error_handler(function ($level, $message, $file, $line, $context)
{
  throw new \ErrorException($message);
});

// will throw an Exception (Undefined variable: foo)
// echo $foo;

// will not throw the exception, PHP will try to call bar() instead
$foo->bar();


Expected result:
----------------
PHP Fatal error:  Uncaught exception 'ErrorException' with message 'Undefined 
variable: foo' in ..:..

Actual result:
--------------
PHP Fatal error:  Call to a member function bar() on a non-object in ... on 
line 0


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=51487&edit=1

Reply via email to