Matthew Weier O'Phinney wrote:
-- Jack Sleight <[EMAIL PROTECTED]> wrote
(on Wednesday, 19 March 2008, 10:44 AM +0000):
Anyone?
Does this deserve reopening the issue and marking it as unresolved?

Well, Zend_Loader::autoload() (which is the callback registered  by
Zend_Loader::registerAutoload()) actually wraps Zend_Loader::loadClass()
in a try/catch block, and returns a boolean false if the class was not
found.

PHP Warnings simply indicate that the file was not loaded; they are not
a fatal issue, but simply an indicator that something is potentially
wrong. In your production environments, I would expect you would have
display_errors off as it is, and these would never be seen. In your
development environment, having these show is probably a good thing, as
it shows potential breakage in your code.

I wouldn't re-open the issue, but if you feel strongly about it, I'd
recommend opening a separate issue asking for the following: that
Zend_Loader::registerAutoload() register an error handler that catches
only the warnings generated by include_once and suppresses them. And
then we can restart the discussion.

Indeed, my original solution to the problem of complete error suppression of include[_once] directives (e.g., invisible parse errors) was to accumulate PHP errors as a property of an Exception object that would be thrown. The problem, of course, is that doing all this fancy stuff in a part of the code that must be fast may exert undue performance costs on people not needing such features in production. It also was not strictly backward compatible with previous behavior. Perhaps this type of behavior could be optional, but performance is definitely something to consider with this part of the framework.

Best regards,
Darby


Jack Sleight wrote:
Hi,
This issue was resolved in 1.5.0: http://framework.zend.com/issues/browse/ZF-2463, which resulted in the error suppression on the include_once on line 83 being removed. However, this causes PHP warnings when a file doesn't exist. This is a problem when using autoload, because autoload functions are not required to successfully include the file, they should simply attempt to include it if they can. No errors should occur if the file cannot be found.

Line 83 should really be changed to:

if (self::isReadable($file)) {
   include_once $file;
}

The current method effectively makes it impossible to simply check if a class exists, using autoload where required.
--
Jack


Reply via email to