Re: strange autoload behavior

From: Date: Thu, 10 Jul 2008 08:14:20 +0000
Subject: Re: strange autoload behavior
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-38893@lists.php.net to get a copy of this message
I have "Fatal error: Class 'Foo' not found" which is expected. Thanks. Dmitry. Gergely Hodicska wrote: > 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ő > >

« previous php.internals (#38893) next »