From:             Bjorn dot Wiberg at its dot uu dot se
Operating system: IBM AIX 5.2.0.0 ML5
PHP version:      5.0.3
PHP Bug Type:     Directory function related
Bug description:  acinclude.m4 should set HAVE_BROKEN_GETCWD for AIX, too

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 bug report at http://bugs.php.net/?id=32501&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32501&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32501&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32501&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32501&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32501&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32501&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32501&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32501&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32501&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32501&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32501&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32501&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32501&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32501&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32501&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32501&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32501&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32501&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32501&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32501&r=mysqlcfg

Reply via email to