I was wondering if the following are bugs or expected behavior/wont change.

Take the following code:
<?php
$handle = fopen("file.txt", "w");
fwrite($handle, "SOME DATA");
unlink("file.txt");
if (fwrite($handle, "SOMEMORE") === FALSE) {
  print "CANNOT WRITE";
} else {
  print "Wrote Data";
}
fclose($handle);
?>

Under linux the file is deleted and the result is Wrote Data (even though the last fwrite didnt do anything).
Under windows, the unlink() call results in a permissions denied error.
Shouldn't linux not allow the file to be deleted with an open stream as well?

Next, URI escpaing:
Stream URIs need to be escaped, but this isn't true with the filesystem.
$test = file_get_contents("t%20e"); // results in error
$test = file_get_contents("t e"); // reads the file "t e"
(same results using full URI file://....)

Why don't filesystem paths have to be escaped but other protocols do?
This is against the RFC as spaces should be escaped.
Behvavior is same on linux and win so not an OS issue.

Rob

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to