From: sborrill at precedence dot co dot uk Operating system: NetBSD 3.1_STABLE PHP version: 5.2.0 PHP Bug Type: Streams related Bug description: Can't open file from cwd if parent folder not readable
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 bug report at http://bugs.php.net/?id=40326&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40326&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40326&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40326&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40326&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40326&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40326&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40326&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40326&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40326&r=support Expected behavior: http://bugs.php.net/fix.php?id=40326&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40326&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40326&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40326&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40326&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40326&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40326&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40326&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40326&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40326&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40326&r=mysqlcfg