Edit report at http://bugs.php.net/bug.php?id=52412&edit=1
ID: 52412
Comment by: php dot net at phrozenbyte dot de
Reported by: madboyka at yahoo dot com
Summary: __autoload fails to throw exception when calling a
static method on the class
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Windows
PHP Version: 5.3.3
Block user comment: N
New Comment:
Same on Ubuntu 10.04 / Apache 2.2 and CLI mode
Test script:
---------------
<?php
spl_autoload_register(
function($autoload) {
throw new Exception();
}
);
try {
Foo::bar();
} catch(Exception $e) {
echo "Exception caught\n";
}
?>
Expected result:
----------------
Exception caught
Actual result:
--------------
Fatal error: Class 'Foo' not found in /home/daniel/www/other/php-bug.php
on line 0
Previous Comments:
------------------------------------------------------------------------
[2010-07-23 09:34:02] madboyka at yahoo dot com
Description:
------------
I've tried to do the following:
1. Wrote and autoload method, that throws an exception.
3. Made a static call on a non-existing class within a try block.
Tried this on windows 7 / Apache 2.2 / PHP 5.3.3.
Test script:
---------------
<?php
function __autoload($class_name) {
throw new Exception($class_name);
}
try {
Application::start();
// new Application(); works fine
} catch (Exception $ex) {
var_dump($ex);
}
Expected result:
----------------
The script should var_dump() an exception with the Message 'Application'
as it does when instantiating a class.
Actual result:
--------------
The script dies with Fatal error: Class 'Application' not found.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52412&edit=1