php zend framework

Both Zend_Cache::_isReadable() and Zend_Loader::isReadable() code and performance could be improved using the new PHP 5.3.2 stream_resolve_include_path() function and removing the error suppression (@). Zend_Cache::_isReadable() can be particularly slow due to error suppression so

private static function _isReadable($filename)
{
    if (!$fh = @fopen($filename, 'r', true)) {
        return false;
    }
    @fclose($fh);
    return true;
}

first of all could be rewritten to:

private static function _isReadable($filename)
{
    return is_string(stream_resolve_include_path($filename));
}

Syndicate content
© 2012 Devis Lucato @itbus.