#30811 [NEW]: virtual() causes relative paths in require() to break
| From: | cantrell at pobox dot com | Date: | Wed, 17 Nov 2004 06:30:29 +0000 |
| Subject: | #30811 [NEW]: virtual() causes relative paths in require() to break | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-69163@lists.php.net to get a copy of this message | ||
From: cantrell at pobox dot com
Operating system: OS X, Linux
PHP version: 4.3.9
PHP Bug Type: Apache related
Bug description: virtual() causes relative paths in require() to break
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 bug report at http://bugs.php.net/?id=30811&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30811&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30811&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30811&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30811&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30811&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30811&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30811&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30811&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30811&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30811&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30811&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30811&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30811&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30811&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30811&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30811&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30811&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30811&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30811&r=mysqlcfg