Re: is_link() behavior
| From: | Andi Gutmans | Date: | Tue, 24 Apr 2001 08:50:36 +0000 |
| Subject: | Re: is_link() behavior | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-52256@lists.php.net to get a copy of this message | ||
It definitely seems as if the logic in the code (filestat.c) is kind of screwed up.
If no one has time to look at it I can try and take a look at it later on.
Andi
At 01:35 AM 4/24/2001 -0500, J. Jones wrote:
This was originally posted to php-general, but for some reason I believe it may belong here. I apologize if I'm wrong. Forgive me for my ignorance, but I've noticed some unwanted behavior (IMO, at least) with the is_link() function. Given the simple code..if ( is_link ("/tmp/this_is_a_symlink") ) print ("Success\n");and the file..lrwxrwxrwx 1 root root 5 Apr 23 21:19 /tmp/this_is_a_symlink -> /bin/the above obviously prints 'Success\n'. However, if I BREAK the symlink, with something like the following..lrwxrwxrwx 1 root root 4 Apr 23 21:21 /tmp/this_is_a_symlink -> foothe script fails with.. Warning: stat failed for /tmp/this_is_a_symlink (errno=2 - No such file or directory) in ./test.php on line 3. The file /tmp/this_is_a_symlink is still a symlink, so it seems to me that the is_link() function should still return true, whether or not the symlink's target exists. Is there perhaps a function I have yet to discover that provides that behavior, without verifying the link's target? I ask this because much of linux's /proc contains (intentionally) broken symlink's and is_link()'s behavior is making the scouring of /proc difficult on me. ;) Thanks for any input.. J. Jones P.S. The script ran as root, so filesystem permissions aren't the issue. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net