php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31553 include does not follow symlinks starting with ..
Submitted: 2005-01-14 14:55 UTC Modified: 2005-01-14 18:21 UTC
From: pterjan at linuxfr dot org Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.10 OS: Mandrakelinux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pterjan at linuxfr dot org
New email:
PHP Version: OS:

 

 [2005-01-14 14:55 UTC] pterjan at linuxfr dot org
Description:
------------
include does not follow symlinks starting with ..

Reproduce code:
---------------
[pterjan@dhcp122 php-test]$ pwd
/tmp/php-test
[pterjan@dhcp122 php-test]$ ll
total 4
drwxr-xr-x  2 pterjan pterjan 4096 jan 14 14:31 a/
lrwxrwxrwx  1 pterjan pterjan    1 jan 14 14:31 b -> a/
lrwxrwxrwx  1 pterjan pterjan   15 jan 14 14:31 c -> /tmp/php-test/a/
lrwxrwxrwx  1 pterjan pterjan   13 jan 14 14:31 d -> ../php-test/a/
lrwxrwxrwx  1 pterjan pterjan    3 jan 14 14:35 e -> ./a/
lrwxrwxrwx  1 pterjan pterjan    6 jan 14 14:48 f -> a/../a/

[pterjan@dhcp122 php-test]$ ll */foo.php
-rw-r--r--  1 pterjan pterjan 0 jan 14 14:31 a/foo.php
-rw-r--r--  1 pterjan pterjan 0 jan 14 14:31 b/foo.php
-rw-r--r--  1 pterjan pterjan 0 jan 14 14:31 c/foo.php
-rw-r--r--  1 pterjan pterjan 0 jan 14 14:31 d/foo.php
-rw-r--r--  1 pterjan pterjan 0 jan 14 14:31 e/foo.php
-rw-r--r--  1 pterjan pterjan 0 jan 14 14:31 f/foo.php

[pterjan@dhcp122 php-test]$ php -r 'include("a/foo.php");'
[pterjan@dhcp122 php-test]$ php -r 'include("b/foo.php");'
[pterjan@dhcp122 php-test]$ php -r 'include("c/foo.php");'
[pterjan@dhcp122 php-test]$ php -r 'include("d/foo.php");'

Warning: Unknown(d/foo.php): failed to open stream: No such file or
directory in Command line code on line 1

Warning: (null)(): Failed opening 'd/foo.php' for inclusion
(include_path='.:/usr/lib/php/:/usr/share/pear/') in Command line code
on line 1
[pterjan@dhcp122 php-test]$ php -r 'include("e/foo.php");'
[pterjan@dhcp122 php-test]$ php -r 'include("f/foo.php");'


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-14 15:00 UTC] pterjan at linuxfr dot org
Just tested with PHP 5.0.2, the problem does not occur.
 [2005-01-14 17:33 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Or it's something wrong with your system. Works fine for me.

 [2005-01-14 18:21 UTC] pterjan at linuxfr dot org
Works fine with the php4-STABLE-200501141530 I just built.
I noticed the Mandrakelinux rpm is built with Hardened-PHP v0.2.4 and 0.2.5 annouces "- fixes the new realpath() implementation with some symlinks" so I guess this was the problem.
Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 18 01:00:01 2025 UTC