php-vfs icon indicating copy to clipboard operation
php-vfs copied to clipboard

touch permission check fails

Open twifty opened this issue 8 years ago • 0 comments

Simple to reproduce:

chmod($fs->path('/var'), 0600);
chown($fs->path('/var'), 'root');
                
touch($fs->path('/var/foo')); // <-- File is created when it should fail
file_put_contents($fs->path('/var/foo'), 'bar'); // <-- without above touch this will, and should, fail

I can see, in the debugger, that the parent /var directory has the owner and mode set correctly.

Wrapper::stream_open line 168, (called by file_put_contents) first checks the parent for writability. Wrapper::stream_metadata line 407, skips that check.

twifty avatar Jun 01 '17 20:06 twifty