ID: 32501 User updated by: Bjorn dot Wiberg at its dot uu dot se Reported By: Bjorn dot Wiberg at its dot uu dot se -Status: Feedback +Status: Open Bug Type: Directory function related Operating System: IBM AIX 5.2.0.0 ML5 PHP Version: 5.0.3 New Comment:
Tried php5-200503310630 (5.1.0-dev), but the problem is still present: Warning: fopen(): open_basedir restriction in effect. File(a.txt) is not within the allowed path(s): (.:/apache/php/lib/php/:/apache/htdocs/bwiberg/) in /apache/htdocs/bwiberg/test/safemode/testopen.php on line 3 Warning: fopen(a.txt): failed to open stream: Not owner in /apache/htdocs/bwiberg/test/safemode/testopen.php on line 3 (It appears that acinclude.m4 hasn't changed at all in this regard, so this was probably expected?) Best regards, Björn Previous Comments: ------------------------------------------------------------------------ [2005-03-30 17:19:05] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-03-30 14:11:41] Bjorn dot Wiberg at its dot uu dot se Description: ------------ As noted in other bug reports (PHP bug #24185), and the documentation (http://www.php.net/manual/en/function.getcwd.php), getcwd() may fail if some directory along a path doesn't have list (r) permissions, but only access (x) permissions. In acinclude.m4, the check for broken getcwd() checks the OS string to determine whether HAVE_BROKEN_GETCWD should be set or not. Currently, this check only detects (and sets HAVE_BROKEN_GETCWD) if the OS is "SunOS". This should probably be changed to include "AIX", too: [EMAIL PROTECTED]:/# uname -sr AIX 2 ...as the problem seems to be present on AIX. Reproduce code: --------------- <?php $handle = fopen("./a.txt", "w", false); if ( $handle ) { fputs($handle, "testtext"); fclose($handle); } ?> Expected result: ---------------- No error message, file gets created. Actual result: -------------- Because fopen() + open_basedir seems to rely on getcwd() to check the path to the file, we get the following error: Warning: fopen(): open_basedir restriction in effect. File(./a.txt) is not within the allowed path(s): (.:/apache/php/lib/php/:/apache/htdocs/bwiberg/) in /apache/htdocs/bwiberg/test/safemode/write.php on line 3 Warning: fopen(./a.txt): failed to open stream: Not owner in /apache/htdocs/bwiberg/test/safemode/write.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32501&edit=1