ID:               40326
 Updated by:       [EMAIL PROTECTED]
 Reported By:      sborrill at precedence dot co dot uk
-Status:           Open
+Status:           Feedback
 Bug Type:         Streams related
 Operating System: NetBSD 3.1_STABLE
 PHP Version:      5.2.0
 New Comment:

Cannot reproduce.
Both PHP 5.2-CVS and PHP 6-CVS work just fine with Apache 1.x.



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

[2007-02-02 15:22:59] sborrill at precedence dot co dot uk

Description:
------------
With PHP versions prior to 5.2.0 (e.g. 5.1.6), you could fopen() a file
in the current working directory (i.e. same as the script) even if a
parent directory only had +x permission and not +rx for the webserver.
With 5.2.0 (and today's 5.2 snapshot) you get "Warning: fopen(file)
[function.fopen]: failed to open stream: No such file or directory
[...]".

If it's of any relevance, with all versions, getcwd() returns FALSE on
NetBSD if a parent folder is not readable, but this does not affect
fopen().

This is affecting any user whose home area is mode 0711 when they run
php from their public_html folder (which is mode 0755).

Reproduce code:
---------------
Ensuring ownership is not same as web server process (e.g. in
public_html in user's home area):

mkdir one
mkdir one/two
chmod 711 one
chmod 755 one/two
echo "test" > one/two/testfile

one/two/index.php contains:
<?php
echo "cwd:".getcwd()."<br>";
$fp=fopen("testfile","r");
if($fp) fpassthru($fp);
?>

Stage one:
chmod 711 one

Stage two:
chmod 755 one

Expected result:
----------------
(stage one):
cwd:
test

(stage two)
cwd: /home/testuser/public_html
test



Actual result:
--------------
(stage 1):
cwd:
Warning: fopen(file) [function.fopen]: failed to open stream: No such
file or directory [...]

(stage two)
cwd: /home/testuser/public_html
test




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


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

Reply via email to