#30811 [Opn->Bgs]: virtual() causes relative paths in require() to break
| From: | tony2001@php.net | Date: | Wed, 17 Nov 2004 16:06:06 +0000 |
| Subject: | #30811 [Opn->Bgs]: virtual() causes relative paths in require() to break | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-69178@lists.php.net to get a copy of this message | ||
ID: 30811
Updated by: tony2001@php.net
Reported By: cantrell at pobox dot com
-Status: Open
+Status: Bogus
Bug Type: Apache related
Operating System: OS X, Linux
PHP Version: 4.3.9
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Your code is similar to:
<? require('./baz.php'); ?>
Obviously baz.php is not in current directory of foo.php.
Previous Comments:
------------------------------------------------------------------------
[2004-11-17 07:30:28] cantrell at pobox dot com
Description:
------------
When virtual() calls another page that contains
require('./xyz'), the require() call breaks. But it
works with require('xyz'), which smells really bad, and
makes me think this is a bug and not just me missing
something.
Posted this to php-general, but got no feedback.
Reproduced on OS X 10.3.6 + Apache 1.3.29 + PHP/4.3.4,
and on Debian + Apache 1.3.31 + PHP/4.3.9-1.
Reproduce code:
---------------
------ foo.php ------
This is foo.
<?php virtual('subdir/bar.php'); ?>
------ foo.shtml (my "control group") ------
This is foo.
<!--#include virtual="subdir/bar.php"-->
------ subdir/bar.php ------
This is bar.
<?php require('./baz.php'); ?>
------ subdir/baz.php ------
This is baz.
Expected result:
----------------
This is foo.
This is bar.
This is baz.
[Note: foo.shtml correctly produces this output; foo.php
should in theory work identically, but does not.]
Actual result:
--------------
This is foo.
This is bar.
Warning: main(./baz.php): failed to open stream: No such
file or directory in /blah/blah/subdir/bar.php on line 2
Fatal error: main(): Failed opening required './baz.php'
(include_path='.:/usr/local/lib/php') in /blah/blah/
subdir/bar.php on line 2
Oddly, it works if bar.php says require('baz.php')
instead of require('./baz.php').
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30811&edit=1