|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-01 16:32 UTC] Bjorn dot Wiberg at its dot uu dot se
[2005-04-04 17:11 UTC] tony2001@php.net
[2005-04-05 09:28 UTC] Bjorn dot Wiberg at its dot uu dot se
[2005-05-09 14:15 UTC] Bjorn dot Wiberg at its dot uu dot se
[2005-07-05 10:21 UTC] Bjorn dot Wiberg at its dot uu dot se
[2005-12-19 17:46 UTC] Bjorn dot Wiberg at its dot uu dot se
[2006-01-26 16:52 UTC] Bjorn dot Wiberg at its dot uu dot se
[2006-12-30 02:36 UTC] iliaa@php.net
[2007-01-07 01:00 UTC] php-bugs at lists dot php dot net
[2007-01-09 10:49 UTC] Bjorn dot Wiberg at its dot uu dot se
[2007-01-10 22:54 UTC] iliaa@php.net
[2012-04-28 04:40 UTC] tata0590 at hotmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 11:00:01 2025 UTC |
Description: ------------ Under safe mode, if one tries to create a new file with fopen(), specifying a filename without any path part in it (such as "./a.txt" or /apache/htdocs/bwiberg/test/safemode/a.txt"), fopen() fails, claiming that the file cannot be found. If the file already exists, everything works just fine. If you specify a path part ahead of the filename, everything works just fine. If you give fopen() "true" as a third argument, and make sure that your include_path includes "." as its FIRST path (if you have several directories in it), everything works just fine. (Perhaps the restriction of only trying the FIRST path should be mentioned in the docs as well.) I'm not sure if this problem is related to the earlier discussions of php_realpath_hack (that fix should be present as "_AIX" is set by gcc under AIX), but it sure poses a problem for scripts which rely on being able to create a file in the current directory without specifying any path. Another question is why $handle in the example script isn't set to FALSE if the open failed -- instead the error propagates to the fputs() part. I'd appreciate any input regarding this. Thanks in advance! Best regards, Björn Reproduce code: --------------- <?php print getcwd() . "<BR>"; $handle = fopen("a.txt", "w", false); if ( $handle != FALSE ) { fputs($handle, "testtext"); fclose($handle); } ?> Expected result: ---------------- /apache/htdocs/bwiberg/test/safemode (File a.txt gets created in current directory.) Actual result: -------------- /apache/htdocs/bwiberg/test/safemode Warning: fopen(): Unable to access a.txt in /apache/htdocs/bwiberg/test/safemode/write.php on line 5 Warning: fopen(a.txt): failed to open stream: No such file or directory in /apache/htdocs/bwiberg/test/safemode/write.php on line 5