From: svecpetr at svecpetr dot com
Operating system: freebsd
PHP version: 5.2SVN-2009-12-24 (snap)
PHP Bug Type: Filesystem function related
Bug description: cron execution with safe-mode fails on file_exists
Description:
------------
read how reproduce this bug FIRST!!!
try execute file_exists($_SERVER['SCRIPT_FILENAME']);
$_SERVER['SCRIPT_FILENAME'] is '/DISK2/WWW/xxx.cz/www/index.php'
it fails with error:
Warning: file_exists(): open_basedir restriction in effect.
File(underconstruction.html) is not within the allowed path(s):
(/DISK2/WWW:/DISK3/WWW:/DISK2/TMP:/NET:/tmp) in
/DISK2/WWW/xxx.cz/www/index.php on line 7
Reproduce code:
---------------
---
>From manual page: function.file-exists#Description
---
safe-mode ON
execute script by CRON, means $_SERVER['REMOTE_ADDR'] is empty
get of getcwd() returns '/'
Expected result:
----------------
why should I change
chdir('/DISK2/WWW/xxx.cz/www/')
before use of function
file_exists($_SERVER['SCRIPT_FILENAME']);
or
file_exists('/DISK2/WWW/xxx.cz/www/index.php')
when I ask this function for file that is IN ALLOWED PATH
Actual result:
--------------
correct file_exists function
--
Edit bug report at http://bugs.php.net/?id=50567&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50567&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50567&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50567&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50567&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50567&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50567&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50567&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50567&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50567&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50567&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50567&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50567&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50567&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50567&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50567&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50567&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50567&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50567&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50567&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50567&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50567&r=mysqlcfg