logo       

Re: Re: Problem with view helper paths: msg#00111

php.zend.framework.mvc

Subject: Re: Re: Problem with view helper paths

-- Janimatti Ellonen
<janimatti.ellonen-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote
(on Saturday, 19 July 2008, 09:04 PM +0300):
> Janimatti Ellonen kirjoitti:

<snip>

> > Now when I try to use $this-> language(); // helper resides in
> > /usr/local/apache2/htdocs/xxxx/application/views/helpers/
> >
> > I get:
> >
> > 'Exception' with message
> > 'fopen(/usr/local/apache2/htdocs/xxx/application/module/image/views/helpers/Language.php)
> >
> > [<a href='function.fopen'> function.fopen</a> ]: failed to open stream:
> > No such file or directory'
> >
> > I assumed that zf would search through all set paths before
> > complaining. Now it seems to just the last path, which is set
> > automatically as I have not set it myself anywhere.
>
>
> The following piece of code seems to solve the problem. Actually I used
> the same code when I hade the same problem with 1.5.0PR.
>
> Current version of method in Zend_Loader (1.5.2) which makes my app go
> bonkers:
>
> public static function isReadable($filename)
> {
> if (!$fh = @fopen($filename, 'r', true)) {
> return false;
> }
>
> return true;
> }
>
> My version, which keeps my app happy:
>
> public static function isReadable($filename)
> {
> if (@is_readable($filename)) {
> return true;
> }

This tells me that one or both of you are using an error_handler that's
being a little too strict and throwing exceptions on warnings. I'd
recommend if you are that you filter out fopen errors.

The changes you have made to Zend_Loader are terribly, terribly
non-performant, and performance will degrade exponentially the more
paths you have on your include_path -- I know, because we switched back
to using the fopen() hack from code that looked like this.

>
> $path = get_include_path();
> $dirs = explode(PATH_SEPARATOR, $path);
>
> foreach ($dirs as $dir) {
> if ('.' == $dir || '..' == $dir) {
> continue;
> }
>
> if (@is_readable($dir . DIRECTORY_SEPARATOR . $filename)) {
> return true;
> }
> }
>
> return false;
> }

--
Matthew Weier O'Phinney
Software Architect | matthew-C1q0ot2/XZ0@xxxxxxxxxxxxxxxx
Zend Framework | http://framework.zend.com/



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise