ID:               24185
 Updated by:       [EMAIL PROTECTED]
 Reported By:      fulcrum at mbnet dot fi
 Status:           Analyzed
 Bug Type:         Documentation problem
 Operating System: NetBSD
 PHP Version:      4CVS-2003-06-14 (stable)
 New Comment:

At least Linux, OpenBSD, AIX, Solaris and HP-UX implementations of
getcwd() should behave the same way.
(I didn't test it, just read the man pages I found with google :)



Previous Comments:
------------------------------------------------------------------------

[2003-06-14 15:14:45] fulcrum at mbnet dot fi

I have experienced on two servers, one Linux (unkown distro) server
running 4.3.1 and an other unkown UNIX (?) computer with the opposite
effect (the effect I was expecting myself). Could this be a OS specific
issue?

Anyways the documenation should be clarified.

------------------------------------------------------------------------

[2003-06-14 13:44:59] [EMAIL PROTECTED]

>From "man getcwd":

RETURN VALUE
  NULL  on failure (for example, if the current directory    
  is not readable), with errno set accordingly,
  and buf on success.

And as PHP just wraps around this function, the behaviour is the same.


------------------------------------------------------------------------

[2003-06-14 12:44:28] fulcrum at mbnet dot fi

Description:
------------
If one of the parent directories of the current working directory
doesn't have the readable flag +r (while +x is still specified)
getcwd() return false, even though the current directory has full (or
at least readable & executale) access (the restrictive permissions
apply ONLY to the parent directory).

The possible return value of false isn't either mentioned in the
documenation.

Reproduce code:
---------------
mkdir one ; mkdir one/two ; mkdir one/two/three
echo "<?php echo gettype(getcwd()).'; '; echo getcwd() ? 'true' :
'false'; ?>" > one/sample.php
echo "<?php echo gettype(getcwd()).'; '; echo getcwd() ? 'true' :
'false'; ?>" > one/two/sample.php
echo "<?php echo gettype(getcwd()).'; '; echo getcwd() ? 'true' :
'false'; ?>" > one/two/three/sample.php
chmod 111 one ; chmod 755 one/two ; chmod 755 one/two/three
chmod 644 one/sample.php ; chmod 644 one/two/sample.php ; chmod 644
one/two/three/sample.php

Expected result:
----------------
one/sample.php:
string; true

one/two/sample.php:
string; true

one/two/three/sample.php:
string; true

Actual result:
--------------
one/sample.php:
string; true

one/two/sample.php:
boolean; false

one/two/three/sample.php:
boolean; false


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24185&edit=1


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to