Problems with virtual()

From: Date: Wed, 08 Mar 2000 15:11:02 +0000
Subject: Problems with virtual()
Groups: php.version4 
Request: Send a blank email to php-version4+get-11772@lists.php.net to get a copy of this message
Addressed to: php4beta@lists.php.net rwidmer@developersdesk.com I found a couple of problems with virtual() in php4b3. Yes, I know php4b4pl1 is out. I have been watching this mailing list and not seen anything about virtual(). I wanted to test with php4b4 before I made this report, but it looks like it may be a week or two before I can make time to install php4b4pl1, and if this is still an issue that may be too late. First, with php4b3, but not php3.0.12 if virtual() is the very first thing sent to the browser you will see some html headers right after the results of the virtual() call. Second virtual appears to change the current directory to the directory where the target file resides, but does not change it back. This happens with both php4b3 and php3.0.12. My include_path is /web/phplib/pre:./:/web/phplib/post Note that ./ is in the path, and is needed for the test. The simplest test I've found to demonstrate the problems: cd to a directory that is document root, create two files and a directory: cd documentroot mkdir virtual create a file virtual.html containing: -------------------------------------------------------------- hello from the virtual.html file in document root -------------------------------------------------------------- create a file virtual.inc containing: -------------------------------------------------------------- hello from the virtual.inc file in document root -------------------------------------------------------------- cd to the directory you just created cd virtual create a file virtual.html containing: -------------------------------------------------------------- hello from the virtual.html file in the subdirectory<BR> -------------------------------------------------------------- create a file virtual.inc containing: -------------------------------------------------------------- hello from the virtual.inc file in the subdirectory -------------------------------------------------------------- Create a file test.php or test.php3 containing: -------------------------------------------------------------- <? virtual( '/virtual/virtual.html' ) ?> <BR> Do you see headers after this virtual call? With php4b3 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 directoory 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 the virtual() changed the current directory and did not change it back... -------------------------------------------------------------- My results on php3.0.12 from http://www.developersdesk.com/virtual/test.php3 hello from virtual.html in the subdirectory Do you see headers after this virtual call? With php4b3 I do, but not with php3.0.12. Somehow I dont 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. OK, lets try calling the include file, you should get the one in the subdirectory. hello from virtual.inc in the subdirectory Now lets call the virtual.html in the root directory and see what happens Hello from the virtual.html file in document root Finally lets see what happens when we call the include file again. hello from the virtual.inc file in document root Oops, it looks like virtual() changed the current directory and did not change it back... -------------------------------------------------------------- My results on php4b3 from http://ns2.developersdesk.com/virtual/test.php3 hello from virtual.html in the subdirectory HTTP/1.1 200 OK Date: Wed, 08 Mar 2000 21:50:58 GMT Server: Apache/1.3.9 (Unix) PHP/4.0b3 mod_ssl/2.4.9 OpenSSL/0.9.4 Connection: close Content-Type: text/html Do you see headers after this virtual call? With php4b3 I do, but not with php3.0.12. Somehow I dont 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. OK, lets try calling the include file, you should get the one in the subdirectory. hello from virtual.inc in the subdirectory Now lets call the virtual.html in the root directory and see what happens Hello from the virtual.html file in document root Finally lets see what happens when we call the include file again. hello from the virtual.inc file in document root Oops, it looks like virtual() changed the current directory and did not change it back... -------------------------------------------------------------- Thanks, Rick

« previous php.version4 (#11772) next »