#21551 [Opn]: is_readable() & is_writable() returns wrong values on related pathes
| From: | xdl at mail dot ru | Date: | Thu, 09 Jan 2003 16:26:46 +0000 |
| Subject: | #21551 [Opn]: is_readable() & is_writable() returns wrong values on related pathes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-29594@lists.php.net to get a copy of this message | ||
ID: 21551
User updated by: xdl@mail.ru
-Summary: is_readable() & is_writable() failed on related paths
Reported By: xdl@mail.ru
Status: Open
Bug Type: Filesystem function related
Operating System: SuSe Linux 7.2
PHP Version: 4.2.3
New Comment:
<?
function s($c) {
echo "\$ $c\n";
system($c);
echo "\n";
}
function wr($f) {
if(is_writable($f)) {
echo "<b>$f</b> is writable.\n";
} else {
echo "<b>$f</b> is <font color='red'>NOT</font>
writable.\n";
}
if(is_readable($f)) {
echo "<b>$f</b> is readable.\n";
} else {
echo "<b>$f</b> is <font color='red'>NOT</font>
readable.\n";
}
}
$dir = "attachments";
s("whoami");
s("pwd");
s("ls -ld $dir");
wr($dir);
$dir2 = "$dir/test";
mkdir("$dir2");
wr($dir2);
//$dir3 =
pwd;
$dir3 = $DOCUMENT_ROOT . "/phpbt/" . $dir;
wr($dir3);
?>
Output is:
------------------------------
$ whoami
nobody
$ pwd
/usr/local/httpd/web/phpbt
$ ls -ld attachments
drwxrwxrwx 4 nobody nogroup 4096 Jan 9 18:50 attachments
attachments is NOT writable.
attachments is NOT readable.
attachments/test is NOT writable.
attachments/test is NOT readable.
/usr/local/httpd/web/phpbt/attachments is writable.
/usr/local/httpd/web/phpbt/attachments is readable.
------------------------------
Previous Comments:
------------------------------------------------------------------------
[2003-01-09 10:21:25] xdl@mail.ru
<?
function s($c) {
echo "\$ $c\n";
system($c);
echo "\n";
}
function wr($f) {
if(is_writable($f)) {
echo "<b>$f</b> is writable.\n";
} else {
echo "<b>$f</b> is <font color='red'>NOT</font>
writable.\n";
}
if(is_readable($f)) {
echo "<b>$f</b> is readable.\n";
} else {
echo "<b>$f</b> is <font color='red'>NOT</font>
readable.\n";
}
}
$dir = "attachments";
s("whoami");
s("pwd");
s("ls -ld $dir");
wr($dir);
$dir2 = "$dir/test";
mkdir("$dir2");
wr($dir2);
//$dir3 = pwd;
$dir3 = $DOCUMENT_ROOT . "/phpbt/" . $dir;
wr($dir3);
?>
Output is:
------------------------------
$ whoami
nobody
$ pwd
/usr/local/httpd/web/phpbt
$ ls -ld attachments
drwxrwxrwx 4 nobody nogroup 4096 Jan 9 18:50 attachments
attachments is NOT writable.
attachments is NOT readable.
attachments/test is NOT writable.
attachments/test is NOT readable.
/usr/local/httpd/web/phpbt/attachments is writable.
/usr/local/httpd/web/phpbt/attachments is readable.
------------------------------
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21551&edit=1