Re: Weird virtual() behavior for nested require()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
    <?php virtual('subdir/bar.php'); ?>

    ------ foo.shtml ------
    This is foo.
    <!--#include virtual="subdir/bar.php"-->

    ------ subdir/bar.php ------
    This is bar.
    <?php require('./baz.php'); ?>

    ------ 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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux