virtual() BUMMER
| From: | rwidmer at developersdesk dot com | Date: | Mon, 27 Mar 2000 23:40:24 +0000 |
| Subject: | virtual() BUMMER | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12717@lists.php.net to get a copy of this message | ||
OK, I just downloaded php4rc1 and tried my Virtual test on it. It fails
both the problems, just like php4b3 did.
Problem 1. If virtual() sends the very first output to the browser, a
second copy of the headers are sent which appear on the page. This is
bug number 2546. I can confirm it is still an issue on RC1.
Problen 2. If the file executed by virtual() is in a different
directory, the current directory is changed to the directory containing
the called file. This is now bug report 3940. It is listed as
version php4b4pl1, but is actually php4RC1, which is not a choice on the
bug report page.
See it for yourself at:
http://ns2.developersdesk.com/virtual/test.php3
Download a copy of the files in a tarball at:
http://ns2.developersdesk.com/virtual/virtualtest.tar.gz
Untar this file in a directory that is document root. It will create a
directory virtual and two files virtual.html and virtual.inc.
Here are the contents:
/virtual.html
----------------------------------------
Hello from the virtual.html file in document root
----------------------------------------
/virtual.inc
----------------------------------------
hello from the virtual.inc file in document root
----------------------------------------
/virtual/firstvirtual.html
----------------------------------------
hello from the first virtual.inc in the subdirectory
----------------------------------------
/virtual/virtual.html
----------------------------------------
hello from virtual.html in the subdirectory<BR>
----------------------------------------
/virtual/virtual.inc
----------------------------------------
hello from virtual.inc in the subdirectory
----------------------------------------
/virtual/test/php3
----------------------------------------
<? virtual( '/virtual/virtual.html' ) ?>
<BR>
Do you see headers after this virtual call? With php4rc1 I do, but not
with php3.0.12. Somehow I don't think they belong there. They only
appear if virtual() is the first html sent to the browser. Even a
single space sent before the virtual() call will prevent it.
<BR><BR>
OK, lets try calling the include file, you should get the one
in the subdirectory.
<BR><BR>
<? include( 'virtual.inc' ) ?>
<BR><BR>
Now lets call the virtual.html in the root directory and see
what happens
<BR><BR>
<? virtual( '/virtual.html' ) ?>
<BR><BR>
Finally lets see what happens when we call the include file again.
<BR><BR>
<? include( 'virtual.inc' ) ?>
<BR><BR>
Oops, it looks like virtual() changed the current directory and
did not change it back...
<BR><BR>
<? phpinfo() ?>
----------------------------------------
The current directory ./ will have to be in your include path for this
to work.
Thanks, Rick