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

 ID:                 47987
 Comment by:         thomas at weinert dot info
 Reported by:        acecream1 at hotmail dot com
 Summary:            Autoload stops working if E_DEPRECATED occurs
 Status:             Assigned
 Type:               Bug
 Package:            SPL related
 Operating System:   *
 PHP Version:        6CVS
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

This happens if you include/eval() source. It works for other errors like 
E_STRICT or E_NOTICE.

Reproduce code:
----------------
<?php
function autoload($class) {
  echo "Autoloader for $class\n";
  eval('class '.$class.' {} ');
}

function error_handler($severity, $text, $file, $line, $context) {
  $class = 'TRIGGER_AUTOLOAD_'.$severity;
  $object = new $class();
  echo $text."\n";
}

spl_autoload_register('autoload');
set_error_handler('error_handler');

eval('$object = &new stdClass();');
?>

Expected result:
----------------

Autoloader for TRIGGER_AUTOLOAD_8192 
Deprecated: Assigning the return value of new by reference is deprecated

Actual result:
----------------

Fatal error: Class 'TRIGGER_AUTOLOAD_8192' not found in 
/<path>/bug47987.php(17) : eval()'d code on line 1


Previous Comments:
------------------------------------------------------------------------
[2009-05-05 11:06:27] col...@php.net

Your error is triggered at compile-time, which disables autoload (and 
spl_autoload at the same time).

Won't be fixed for PHP5.3 as it may cause lots of other problems.

------------------------------------------------------------------------
[2009-04-19 22:30:47] col...@php.net

I believe this is due to the fact that this specific error is 
triggered at compile time, not that it's a E_DEPRECATED. I'll check it 
out.

------------------------------------------------------------------------
[2009-04-16 13:22:07] acecream1 at hotmail dot com

Description:
------------
I use my custom error_handler and
when it is called i throw my custom exception which is being autoloaded using 
spl_autoload_register when first error occours.

This works normaly if Notice or Warning occours (did not test all the error 
types) but in case of E_DEPRECATED error the autoload is not called and i this 
reflects in a fatal error becouse my exception class does not exist.

Reproduce code:
---------------
1. spl_autoload_register(array($class, $method));
2. set_error_handler(array($this, 'handleError'));
3. Params\Store\Get::getInstance(&$_GET);

//Call-time pass-by-reference has been deprecated 
D:\www\lib\framework\Framework\Params.php on line 25

Expected result:
----------------
When E_DEPRECATED error would occour i would expect that all registered 
autoloaders would still function inside the error handler.

Actual result:
--------------
Fatal error: Class 'Framework\Error\Handler\Exception' not found in 
D:\www\lib\framework\Framework\Params.php on line 25


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



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

Reply via email to