PHP 4.0 Bug #3940: Virtual changes current directory - php4RC1!!

From: Date: Tue, 28 Mar 2000 06:22:46 +0000
Subject: PHP 4.0 Bug #3940: Virtual changes current directory - php4RC1!!
Groups: php.dev 
Request: Send a blank email to php-dev+get-17304@lists.php.net to get a copy of this message
From: rwidmer@developersdesk.com Operating system: Red Hat Linux 5.2 PHP version: 4.0 Beta 4 Patch Level 1 PHP Bug Type: Misbehaving function Bug description: Virtual changes current directory - php4RC1!! If the file executed by virtual() is in a different directory, the current directory is changed to the directory containing the virtual() file. 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 ---------------------------------------- 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. My system is: Apache 1.3.12 mod_SSL 2.6.2 openssl 0.9.5 php4rc1

« previous php.dev (#17304) next »