Re: Comments on bugs marked bogus

From: Date: Tue, 26 Jul 2005 19:32:22 +0000
Subject: Re: Comments on bugs marked bogus
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-38918@lists.php.net to get a copy of this message
Hi, Scott Mattocks wrote:
BTW, the most obvious problem with brain-dead __autoload() implementation described by Scott in the bug report is the following. Consider: some package author would like to check for PEAR errors, but save the overhead of loading PEAR.php when there is no error, so he writes: if (is_a($returnValue, 'PEAR_Error')) {
    ...
} Now brain-dead __autoload() kicks in and immediately dies, for there is no PEAR/Error.php: PEAR_Error is defined in PEAR.php.
Now you are just being a jerk. You also aren't paying much attention to details. The implementation I provided uses include_once. The page will not die. It will just spit out a bunch of errors. The page will continue to load. Had I used require_once you may have a point, but since I am not brain-dead, I used include_once. You can read up on include_once here if you need to: http://us2.php.net/manual/en/function.include-once.php
Well, you can use the magic @ operator then and your brain-dead function will not spit out any errors! See how easy it is to fix? Now go and fix, quick!
Also, a developer should not write the example you provided. They should be using PEAR::isError().
This approach was actually promoted on this mailing list and there are several prominent packages using it. So unless you are willing to open a *really huge* can of worms I suggest you shut up now.

« previous php.pear.dev (#38918) next »