note 57765 deleted from function.is-readable by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 14:54:10 +0000 |
| Subject: | note 57765 deleted from function.is-readable by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197215@lists.php.net to get a copy of this message | ||
Note Submitter: DrTebi at yahoo dot com
----
Be careful when using is_readable on symbolic links.
is_readable will return true if the file the symbolic link is pointing to is readable.
The problem is that if the server does NOT allow to follow symbolic links, is_readable will still
return true, but e.g. redirecting to the sybolic link will not work. For Apache, make sure that at
the server, virtual host configuration level, or inside a directory container you have set
Options +FollowSymLinks
As an example, let's say you have at the document root directory:
index.php -- the script using is_readable
my_linked_page.html -- a regular HTML page
my_link -- a link pointing to my_linked_page.html
Now in index.php:
<?php
if (is_readable('my_link')) {
header('Location: /my_link');
}
?>
If FollowSymLinks is forbidden, this will not work, if allowed, it will.