On Thursday 07 August 2008 21:52:37 Rasmus Lerdorf wrote:
> Felipe Pena wrote:
> > Em Qui, 2008-08-07 às 20:55 +0200, Hannes Magnusson escreveu:
> >> On Thu, Aug 7, 2008 at 20:20, Rasmus Lerdorf<[EMAIL PROTECTED]>  wrote:
> >>> Christian Stocker wrote:
> >>>> Hi
> >>>>
> >>>> Since quite some time (weeks), I have this very strange and annoying
> >>>> include bug in 5.3-dev and now I think is the time to report it :)
> >>>>
> >>>> The reproducable script is here:
> >>>>
> >>>> http://trash.chregu.tv/include-bug.php.txt
> >
> > When trying debug it days ago, I noticed add that:
> > +++ TSRM/tsrm_virtual_cwd.c     4 Jul 2008 03:05:16 -0000
> > @@ -557,9 +557,11 @@ CWD_API int virtual_file_ex(cwd_state *s
> >         if (use_realpath != CWD_EXPAND) {
> >   #if !defined(TSRM_WIN32)&&  !defined(NETWARE)
> >                 char resolved_path[MAXPATHLEN];
> > +               printf(">>>  %s\n", path);
> >                 if (!realpath(path, resolved_path)) {  /* Note: Not
> > threadsafe on older *BSD's */
> > +                       printf(">>  1\n");
> >                         if (use_realpath == CWD_REALPATH) {
> > +                               printf(">>  2\n");
> >
> > ----------------------------------------------------------------
> >
> > LINUX:
> >>>> /home/felipe/php5/sapi/cli/php
> >>>> /home/felipe/php5/sapi/cli/php
> >>>> /home/felipe/php5/sapi/cli/php-cli.ini
> >>>
> >>> 1
> >>>
> >>>> /usr/local/lib/php-cli.ini
> >>>
> >>> 1
> >>>
> >>>> /home/felipe/php5/sapi/cli/php.ini
> >>>
> >>> 1
> >>>
> >>>> /usr/local/lib/php.ini
> >>>> /usr/local/lib/php.ini
> >>>> /home/felipe/test/test.php
> >>>> /home/felipe/./foo.php
> >>>
> >>> 1
> >>> 2
> >>>
> >>>> /usr/local/lib/php/foo.php
> >>>
> >>> 1
> >>> 2
> >>>
> >>>> /home/felipe/test/foo.php
> >
> > foo
> >
> > ----------------------------------
> >
> > BSD:
> >>>> /usr/home/felipe/php5/sapi/cli/php
> >>>> /usr/home/felipe/test/test.php
> >>>> /usr/home/felipe/./foo.php
> >
> > Warning: include(/usr/home/felipe/foo.php): failed to open stream: No
> > such file or directory in /usr/home/felipe/test/test.php on line 1
> >
> > Warning: include(): Failed opening 'foo.php' for inclusion
> > (include_path='.:/usr/local/lib/php') in /usr/home/felipe/test/test.php
> > on line 1
>
> That's not the same thing though.  Your case seems to show that it isn't
> using the include_path at all.  On BSD after checking ./foo.php why
> doesn't it continue on to /usr/local/lib/php/foo.php?  It certain does
> for me here.
>
> -Rasmus

Hi,

I had searched the cause of this bug some days ago and posted what I have 
found on http://bugs.php.net/bug.php?id=45044 . 

virtual_file_ex() assumes that realpath() returns NULL when the file does not 
exists. But BSD's realpath() will not return NULL if all
components *but the last* exist. So realpath(/foo/bar) will return /foo/bar 
even if bar does not exists.

Regards,

Arnaud

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to