Johannes Schlüter wrote:
> Greg,
>
> On Wed, 2007-10-03 at 15:07 -0500, Greg Beaver wrote:
>> Now what? The error message doesn't tell Joe where to find PEAR2::Foo,
>> or any other useful information on how to find it, just that it can't be
>> found. PEAR2, however, knows exactly where it should be found, and has
>> some idea of why it isn't there (package not installed). In addition,
>> there is no stack trace that can be used to debug the call chain that
>> led to the problem if PEAR2::Foo *is* installed, and Joe reports the
>> problem to the maintainers of PEAR2::Blah.
>>
>> Without my die(new Exception()), there is no way to pass this known
>> information back out of PEAR2_Autoload to Joe, and it makes both
>> development and debugging much more difficult, and unnecessarily so.
>
> function __autoload($a) {
> $b = debug_backtrace();
> if ($bt[1]["function"] == "class_exists") {
> echo "in get_class";
> }
> }
>
> should work quite well without obscure engine hacks - or am I missing
> something?
I do that now, but it is a severe performance hog as well as being
fugly. Also, if you use spl_autoload_register, the frame is $bt[2]. In
other words, it's possible, but still an ugly, unnecessary hack with
lots of potential pitfalls caused by the inability to customize an error
message when a class doesn't exist.
Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php