php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42048 require fails to include relative path names
Submitted: 2007-07-19 14:17 UTC Modified: 2007-07-19 15:18 UTC
From: quasi at di dot uoa dot gr Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.2.3 OS: Solaris 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: quasi at di dot uoa dot gr
New email:
PHP Version: OS:

 

 [2007-07-19 14:17 UTC] quasi at di dot uoa dot gr
Description:
------------
commands like require('../somefile') fail although they didn't in versions prior to 5.2.0. This happens when the user running the command does not have 'r' rights to the directory of the included file. Bug #39351 seems related but it is supposedly closed.

Reproduce code:
---------------
cd tmp
umask 022
mkdir d1
chmod 711 d1
cd d1
echo Included > fin.php
mkdir d2
cd d2
echo '<? require("/tmp/d1/fin.php") ?>' > f.php
echo '<? require("../fin.php") ?>' >> f.php
php /tmp/d1/d2/f.php


Expected result:
----------------
Included
Included

Actual result:
--------------
Included

Warning: require(../fin.php): failed to open stream: Permission denied in f.php on line 2

Fatal error: require(): Failed opening required '../fin.php' (include_path='.:/opt/php/lib/php') in f.php on line 2


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-19 14:57 UTC] quasi at di dot uoa dot gr
Sorry, I forgot to stress that the user executing "php /tmp/d1/d2/f.php" must be some other user and not the one that created the files so that the 711 access rights have some actual impact...
 [2007-07-19 15:18 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #41822
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 12:01:27 2024 UTC