php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50567 cron execution with safe-mode fails on file_exists
Submitted: 2009-12-24 09:36 UTC Modified: 2013-02-18 00:34 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: svecpetr at svecpetr dot com Assigned:
Status: No Feedback Package: Safe Mode/open_basedir
PHP Version: 5.2SVN-2009-12-24 (snap) OS: freebsd
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: svecpetr at svecpetr dot com
New email:
PHP Version: OS:

 

 [2009-12-24 09:36 UTC] svecpetr at svecpetr dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-24 23:22 UTC] jani@php.net
What is the exact error you get with exactly what line of code? And what is open_basedir set to? (EXACTLY..)
 [2009-12-25 15:12 UTC] svecpetr at svecpetr dot com
just read :o)

open_base dir is: /DISK2/WWW:/DISK3/WWW:/DISK2/TMP:/NET:/tmp

error message is: Warning: file_exists(): open_basedir restriction in effect.
File('/DISK2/WWW/xxx.cz/www/index.php') 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
 [2009-12-25 16:30 UTC] rasmus@php.net
Any symlinks involved anywhere along that path?

And yes, as Jani asked for, your relevant php.ini settings and a 
reproducing script would help us determine what is going on here.  
open_basedir works fine, so there is something you are not telling us.
 [2010-01-06 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-25 20:39 UTC] felipe@php.net
-Status: No Feedback +Status: Feedback
 [2010-04-25 20:39 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC