php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45044 relative paths not resolved correctly
Submitted: 2008-05-20 01:27 UTC Modified: 2008-08-12 09:42 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: felipensp at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-05-20 (CVS) OS: FreeBSD 6.3
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: felipensp at gmail dot com
New email:
PHP Version: OS:

 

 [2008-05-20 01:27 UTC] felipensp at gmail dot com
Description:
------------
I've created:

~/test
~/test/test.php: <?php include 'foo.php'; ?>
~/test/foo.php: "foobar"

Due this issue all tests (.phpt) that uses include/require fails.

PS: This works fine on 5_2.

Reproduce code:
---------------
[felipe@PCBSD ~]$ php5/sapi/cli/php test/test.php

Expected result:
----------------
foobar

Actual result:
--------------
Warning: include_once(/usr/home/felipe/foo.php): failed to open 
stream: No such file or directory in /usr/home/felipe/test/test.php 
on line 6

Warning: include_once(): Failed opening 'foo.php' for inclusion 
(include_path='.:/usr/local/lib/php') 
in /usr/home/felipe/test/test.php on line 6

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-20 02:44 UTC] cellog@php.net
cellog@lot-49:/home$ cd felipe
cellog@lot-49:/home/felipe$ mkdir test
cellog@lot-49:/home/felipe$ cd test
cellog@lot-49:/home/felipe/test$ echo "<?php include 'foo.php'; ?>" >> test.php
cellog@lot-49:/home/felipe/test$ echo "foobar" >> foo.php
cellog@lot-49:/home/felipe/test$ cd ..
cellog@lot-49:/home/felipe$ ../cellog/workspace/php5/sapi/cli/php test/test.php
foobar

I am on linux.  I suspect zend_resolve_path is broken on FreeBSD and this is part of the segfault you described in phar on IRC.

Can we find another FreeBSDer to confirm this?
 [2008-05-30 20:19 UTC] philip@php.net
status->verified 
 [2008-07-24 19:27 UTC] lbarnaud@php.net
virtual_file_ex() assume that if realpath() does not return NULL the file exists. 

The problem is that FreeBSD's realpath() will not return NULL if all components *but the last* exist.

So php_resolve_path()/tsrm_realpath() will pass /usr/home/felipe/foo.php to virtual_file_ex() and assume it exists.
 [2008-08-06 15:33 UTC] chregu@php.net
I can verify this on OS X 10.4 with this reproducable script

http://trash.chregu.tv/include-bug.php.txt



 [2008-08-06 15:33 UTC] tony2001@php.net
Dmitry, could you take a look at this, plz?
 [2008-08-12 08:55 UTC] jani@php.net
Isn't this fixed now by Dmitry's commit..?
 [2008-08-12 09:42 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_3.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Feb 04 04:01:32 2025 UTC