[PHP] Weird virtual() behavior for nested require()

2004-11-15 Thread Paul Cantrell
I'm getting a weird behavior when virtual() calls another page that 
uses a require().  The behavior seems contrary to the docs for virtual.

Consider these four files:
-- foo.php --
This is foo.

-- foo.shtml --
This is foo.

-- subdir/bar.php --
This is bar.

-- subdir/baz.php --
This is baz.
According to the docs, virtual() handles the argument as an Apache 
subrequest -- in other words, it should be equivalent to an SSI 
include.  But it's not.  As I would expect, foo.shtml produces this:

This is foo. This is bar. This is baz.
Here's what I get from foo.php:
This is foo. This is bar.
Warning: main(./baz.php): failed to open stream: No such file or 
directory in
/blah/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/blah/subdir/bar.php on line 2

Oddly, it works if bar.php says require('baz.php') instead of 
require('./baz.php').  That smells really bad.  Is this a bug, or am I 
missing something?

Cheers,
Paul
_
"After hearing ten thousand explanations, a fool is no wiser.
 But an intelligent person needs only two thousand five hundred."
   -- Mahabharata
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Weird virtual() behavior for nested require()

2004-11-16 Thread Paul Cantrell
Well, after 36 hours of silence on this one, I'll consider the 
php-general list stumped, and file it as a bug.

P
On Nov 15, 2004, at 11:50 AM, Paul Cantrell wrote:
I'm getting a weird behavior when virtual() calls another page that 
uses a require().  The behavior seems contrary to the docs for 
virtual.

Consider these four files:
-- foo.php --
This is foo.

-- foo.shtml --
This is foo.

-- subdir/bar.php --
This is bar.

-- subdir/baz.php --
This is baz.
According to the docs, virtual() handles the argument as an Apache 
subrequest -- in other words, it should be equivalent to an SSI 
include.  But it's not.  As I would expect, foo.shtml produces this:

This is foo. This is bar. This is baz.
Here's what I get from foo.php:
This is foo. This is bar.
Warning: main(./baz.php): failed to open stream: No such file or 
directory in
/blah/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/blah/subdir/bar.php on line 2

Oddly, it works if bar.php says require('baz.php') instead of 
require('./baz.php').  That smells really bad.  Is this a bug, or am I 
missing something?

Cheers,
Paul
_
"After hearing ten thousand explanations, a fool is no wiser.
 But an intelligent person needs only two thousand five hundred."
   -- Mahabharata
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

_
"Prediction is hard, especially of the future."  -- Niels Bohr
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php