Hi!

I think I found a bug but before posing it to bugs.php.net I would like
to ask your opinion. I think the it is not a planed behavior that some
errors doesn't "bubble up" from autoload, but at least the error message
is misleading.

---------------------------------------------
foo.php:
<?php
throw new Exception();
class foo {}
?>

bar.php:
<?php
class bar extends foo {}
?>

bootstrap.php
<?php
function __autoload($className)
{
        include $className.'.php';
}
new bar();
?>
---------------------------------------------
Result: "Fatal error: Class 'bar' not found".


The code above seems not to be too realistic but the next one is:
---------------------------------------------
foo.php:
<?php
define('error', oops_i_left_the_quotes);
class foo {}
?>

bar.php:
<?php
class bar extends foo {}
?>

bootstrap.php
<?php
function __autoload($className)
{
        include $className.'.php';
}
function error_handler()
{
        throw new Exception();
}
set_error_handler("error_handler");
new bar();
?>
---------------------------------------------
Result: "Fatal error: Class 'bar' not found".


And for example if define a class level constant without quotes I get
the exception generated by the Notice.


Best Regards,
Felhő


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to