Closed GoogleCodeExporter closed 8 years ago
If the Prado autoloader is installed as the last one and is throwing an
exception, then that means that you already have a fatal problem there, because
the class you're trying to instantiate can not be found. So you already have a
problem in your applicatin - and Prado's just exposing it. Leaving the job of
throwing the exception to some other code (to what code?) wouldn't solve the
problem at that point.
That said failure to load a class can have two reasons:
1. the class file itself does not exist on the include path
2. the class file itself does exist and has been found, but there's a problem
with parsing your the file or the class, which prevents the class in it
actually getting defined in the PHP runtime environment.
So I'd begin tracking down the problem first by checking whether you do
actually have the class file for the class you want to instantiate, whether
it's directory is on your include path, and whether there are any errors while
loading/parsing the file (which could be checked by you include()ing it
"manually" right prior to the instantiation attempt).
Original comment by google...@pcforum.hu
on 3 Mar 2013 at 3:08
I'm not concerning a class instantiation in my code, the issue is calling
class_exists() to *prevent* instantiation of non-existent classes, which should
return FALSE and not throw a fatal.
For what it matters, calling include_once does not either allow reaching the
Prado::fatalError() call.
Original comment by ciromat...@gmail.com
on 3 Mar 2013 at 6:41
Basically any usage of a not-existing (or misspelled) class or every syntax
error in a class file will result in an autoloading failure; prado assumes that
you actually need the class you're trying to load, and then stops the execution
flow reporting the error as fatal.
I myself had problems in the past with this behavior of prado, when including
3rd party code that uses another autoloader: a typical workaround is to
register the prado autoloader as the last in the chain.
Imho the benefits of the proposed change won't pay back the loss of basic error
reporting.
Original comment by ctrlal...@gmail.com
on 3 Mar 2013 at 10:39
Original issue reported on code.google.com by
ciromat...@gmail.com
on 28 Feb 2013 at 11:33