Bug #52587 [Asn->Opn]: Clearstatcache() has no effect
Edit report at https://bugs.php.net/bug.php?id=52587&edit=1
ID: 52587
Updated by: kalle@php.net
Reported by: a-krcrai at microsoft dot com
Summary: Clearstatcache() has no effect
-Status: Assigned
+Status: Open
Type: Bug
Package: *Directory/Filesystem functions
Operating System: Windows
PHP Version: 5.3.3
-Assigned To: pajoye
+Assigned To:
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2013-01-31 15:19:11] snooops84 at googlemail dot com
Hello,
im able to reproduce this on Debian 6 (Linux some 2.6.32-5-amd64 #1 SMP Sun Sep
23 10:07:46 UTC 2012 x86_64 GNU/Linux) with PHP 5.3.3-7+squeeze14.
getfacl meyer.txt
user:www-data:rwx #effective:r--
my test.php
if (is_writable('meyer.txt')) {
echo 'writeable';
}
else {
echo 'not writeable';
}
if i execute this with su - www-data -s /bin/bash i get "not writeable", but if
i try to move it by hand with as www-data with mv meyer.txt foo.txt it works! i
get the same behavior with fopen (it returns false).
------------------------------------------------------------------------
[2010-08-12 11:14:40] pajoye@php.net
Will double check that with Kris once I'm back.
------------------------------------------------------------------------
[2010-08-12 04:54:37] a-krcrai at microsoft dot com
Oh, and this was reproduced on both VC6 and VC9 I'm pretty sure.
------------------------------------------------------------------------
[2010-08-12 04:53:30] a-krcrai at microsoft dot com
If you're getting all true dumps, then that means that either you're using 5.2.x (which
I'm assuming you're not), or it means that the directory/file exists but that the
permissions aren't being successfully applied (or some other weird ACL issue on your system).
This is because, even if you couldn't reproduce the bug, you should still be getting false for
the first two results, since full access is being denied (meaning the file should be neither
readable nor writable).
Fortunately, debugging this is pretty simple. I'd like you to do two things for me, if you
don't mind:
1. Pipe the exec calls to an array (see php.net/exec for details on how to do this), then do a
print_r() of said array and paste the output of that here. This will show us if SetACL is having
trouble setting the permissions on your system.
2. *Either*:
After the first pair of var_dumps, go ahead and temporarily toss in a die() statement and re-run the
script. Then, from the command-line, type "notepad testdir/testfile". If the SetACL
calls executed properly, this should pop-up a Notepad window with an "Access Denied" popup
message. If, on the other hand, Notepad loads your file just fine, then that means the file is
readable and thus the ACL permissions were never applied.
*Or*:
If you have Powershell installed, open that and CD to whatever directory your PHP script is in.
Then type "get-acl testdir/testfile | format-list" and paste the output here.
------------------------------------------------------------------------
[2010-08-12 04:42:25] kalle@php.net
Just did a test following the steps from your comment, my results are so far:
php-trunk, VC9, x86, ZTS/NTS:
bool(true)
bool(true)
bool(true)
bool(true)
php-53, VC9, x86, ZTS/NTS:
bool(true)
bool(true)
bool(true)
bool(true)
I interpreted your steps as:
1) mkdir testdir
2) php -r "file_put_contents('./testdir/testfile', 'PHP on Windows');"
3) Make a php file with the above code inside
4) php bug52587.php
About ACL:
C:\php>setacl -help
SetACL by Helge Klein
Homepage: http://setacl.sourceforge.net
Version: 2.0.3.0
Copyright: Helge Klein
License: GPL
Did you use VC6 or VC9 binaries for your testing?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=52587
--
Edit this bug report at https://bugs.php.net/bug.php?id=52587&edit=1
Thread (7 messages)