Re: is_link() behavior
| From: | J. Jones | Date: | Wed, 25 Apr 2001 06:19:45 +0000 |
| Subject: | Re: is_link() behavior | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-52360@lists.php.net to get a copy of this message | ||
On Wed, Apr 25, 2001 at 01:05:00AM -0500, J. Jones wrote:
> On Wed, Apr 25, 2001 at 08:56:47AM +0200, Andi Gutmans wrote:
> > I commited another fix.
> > is_link() should work correctly now. If things have improved and you have
> > problems with lstat() and filetype() (which I think there's a good chance
> > that they are screwed up) let me know.
> > Thanks,
> > Andi
>
> --new output
> :(01:02am ~/php): ./fs-test.php
> is_link passed
> readlink passed: /bin/false
> filetype passed: link
> lstat passed:
>
> Array
> (
> [0] => 770
> [1] => 749
> [2] => 41471
> [3] => 1
> [4] => 0
> [5] => 0
> [6] => 0
> [7] => 10
> [8] => 988178527
> [9] => 988178527
> [10] => 988178527
> [11] => 4096
> [12] => 1
> )
> is_link passed
> readlink passed: /this/file/does/not/exist
>
> Warning: stat failed for /tmp/test-link-func (errno=2 - No such file or
> directory) in ./fs-test.php on line 11
> filetype failed
>
> Warning: stat failed for /tmp/test-link-func (errno=2 - No such file or
> directory) in ./fs-test.php on line 14
> lstat failed
> --end
>
Ok.. is_link() and readlink() (I realize this is in a separate section,
but I still use it as opposed to lstat() to get the link's target) are the only
two functions that work on broken symlinks.
filetype(), lstat(), and file_exists() all fail (the latter probably should, eh?).
I assume all the file<someinfo>() functions will fail also, since they are
based on lstat() or stat().