Bug #60149 [Com]: SPL autoloader not called in error handler triggered by private __call
Edit report at https://bugs.php.net/bug.php?id=60149edit=1 ID: 60149 Comment by: phil at propcom dot co dot uk Reported by:gedrox at gmail dot com Summary:SPL autoloader not called in error handler triggered by private __call Status: Open Type: Bug Package:SPL related Operating System: Ubuntu 11.10 PHP Version:5.3.8 Block user comment: N Private report: N New Comment: This is similar to https://bugs.php.net/bug.php?id=54054. The two may be related. Previous Comments: [2011-10-27 15:18:57] gedrox at gmail dot com Description: No SPL registered autoloader is called inside custom error handler if it has been triggered by private __call() magic function what should be public instead. Test script: --- http://gedrox.eu/php_spl_autoloader_error_handler_private_call.tar Run run.php file. Expected result: Tried to load class 'DoesNotExist_1' Caught error 'The magic method __call() must have public visibility and cannot be static' Tried to load class 'DoesNotExist_2' Done Actual result: -- Tried to load class 'DoesNotExist_1' Caught error 'The magic method __call() must have public visibility and cannot be static' Fatal error: Uncaught exception 'RuntimeException' with message 'Assertion failed on line '66' in LoaderTest.php on line 45 RuntimeException: Assertion failed on line '66' in LoaderTest.php on line 45 Call Stack: 0.0001 635080 1. {main}() run.php:0 0.0003 665536 2. LoaderTest-testFailure() run.php:6 0.0004 670584 3. assert() LoaderTest.php:66 0.0004 671144 4. LoaderTest-assertionFail() LoaderTest.php:0 -- Edit this bug report at https://bugs.php.net/bug.php?id=60149edit=1
Bug #54054 [Com]: Autoload not called in user-defined error handler function in case of E_STRICT
Edit report at https://bugs.php.net/bug.php?id=54054edit=1 ID: 54054 Comment by: phil at propcom dot co dot uk Reported by:morpika at vipmail dot hu Summary:Autoload not called in user-defined error handler function in case of E_STRICT Status: Open Type: Bug Package:*Programming Data Structures Operating System: FreeBSD 8.0 PHP Version:5.3.5 Block user comment: N Private report: N New Comment: This is still an issue. The 2 test cases below should hopefully sum this up for you. Case 1... include() call fails and generates an E_WARNING E_WARNING is caught by the error handler Error handler attempts to use \Error class and calls the autoloader because it is not currently loaded ...Case 2 The included file (http://codepad.viper-7.com/xyCn8C) generates an E_STRICT E_STRICT is caught by the error handler Error handler attempts to use \Error class and fails with a fatal error WITHOUT calling the autoloader The problem is that, in case 2, it is expected that the autoloader would be used to load the \Error class. This doesn't appear to be the case. Case 1: http://codepad.viper-7.com/b065B1 Case 2: http://codepad.viper-7.com/qi5185 Included file (xyCn8C) in Case 2: http://codepad.viper-7.com/xyCn8C Previous Comments: [2011-02-19 14:39:37] morpika at vipmail dot hu Description: __autoload function is not called in user-defined error handler function in case of E_STRICT error. In case of any other type of errors (thet user-defined error handler function can handle) the autoload function is called properly. Test script: --- test.php: ?php set_error_handler('php_error'); function php_error($errno, $errcode) { t_class::t_function($errno, $errcode); } function __autoload($class_name) { echo 'autoload called'; exit; } require('nf.php'); ? nf.php (to create an E_STRICT ERROR: Redefining already defined constructor): ?php class number_format { public function __construct() {} public function number_format($number) { echo number_format($number, 0, '.', '.'); } } ? Expected result: autoload called Actual result: -- Fatal error: Class 't_class' not found -- Edit this bug report at https://bugs.php.net/bug.php?id=54054edit=1
Bug #42098 [Com]: E_STRICT doesn't trigger __autoload()
Edit report at https://bugs.php.net/bug.php?id=42098edit=1 ID: 42098 Comment by: phil at propcom dot co dot uk Reported by:nicolas dot grekas+php at gmail dot com Summary:E_STRICT doesn't trigger __autoload() Status: Bogus Type: Bug Package:Scripting Engine problem Operating System: * PHP Version:5.2.3 Block user comment: N Private report: N New Comment: This is related to https://bugs.php.net/bug.php?id=54054edit=2 which I have just commented on proving some, hopefully, sane example code. Previous Comments: [2010-05-25 11:12:20] i at walkinraven dot name I think autoload will not work in exception_handler or error_handler, that is the problem. [2007-08-17 23:08:16] tony2...@php.net Ah ah ! You play with words :) No, he just said the same thing in other words. The first time, you said : - Only execute time errors can be caught with user error handler., and now: - during compile - autoload wont be triggered There are two stages: 1) compile; 2) execute. Compile-time errors cannot be caught, only execute-time errors can be. But that's still a bug for me in this case. My workaround does exactily what PHP internals should do automagically, nothing more ! This is how the things work. [2007-08-17 22:54:31] nicolas dot grekas+php at gmail dot com Ah ah ! You play with words :) The first time, you said : - Only execute time errors can be caught with user error handler., and now: - during compile - autoload wont be triggered You was wrong the first time ! And you may be right the second time. But that's still a bug for me in this case. My workaround does exactily what PHP internals should do automagically, nothing more ! Please consider it quietly, I'm not submitting this bug for fun. I do know the workaround now. It's for others developpers around the world who enjoy PHP a its best... [2007-08-17 22:40:32] j...@php.net And that proves I'm right. __autoload() won't happen during compile. And this error happens during compile - autoload wont be triggered. [2007-08-17 22:37:41] nicolas dot grekas+php at gmail dot com yes, with an include : replace the eval with include 'toto.php', where toto.php contains ?php class A { function toto( ) {} } class B extends A { function toto($a) {} } ? this is how I hit the bug the first time The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=42098 -- Edit this bug report at https://bugs.php.net/bug.php?id=42098edit=1