| Bug #14295 | Scope of globals has changed | ||||
|---|---|---|---|---|---|
| Submitted: | 30 Nov 2001 3:51am UTC | Modified: | 31 Dec 2001 7:41pm UTC | ||
| From: | v dot puttrich at digitalliquid dot de | Assigned to: | |||
| Status: | Bogus | Category: | Variables related | ||
| Version: | 4.0.6 | OS: | Win2k | ||
[30 Nov 2001 3:51am UTC] v dot puttrich at digitalliquid dot de
[30 Nov 2001 12:25pm UTC] sniper@php.net
Please include short example scripts here.
[30 Nov 2001 3:07pm UTC] v dot puttrich at digitalliquid dot de
EXAMPLE:
// Main script
// The global variables are available in this script
include("form.inc.php");
...
// End main script
----
// File: form.inc.php
// The global variables from the main script are not available here
<form action="<?php echo $PHP_SELF; ?>" method="post">
[form]
</form>
// End file: form.inc.php
[2 Dec 2001 1:52am UTC] zak@php.net
Cannot reproduce under PHP 4.1.0 w/ Linux Please try the code below. Save the files under the names indicated in the comments and try running test.php: # test.php <?php include 'test.inc'; echo "Main File: $PHP_SELF" ?> # test.inc <?php echo "Included File: $PHP_SELF" ?>
[4 Dec 2001 7:34pm UTC] sniper@php.net
I can not reproduce this with PHP 4.1.0RC5 either.
[5 Dec 2001 1:49am UTC] v dot puttrich at digitalliquid dot de
Zak: I did try it and could reproduce with your code. I found out, that it only happens when i'm running my scripts on Win2k. On Linux my scripts are running as expected and I don't need to declare $PHP_SELF global again. The only difference in my PHP configuration is: On Win2k virtual dirs is enabled, on Linux it's disabled. Well, I don't know where to set virtual directory support on/off, so I can't verify.
[6 Dec 2001 7:41am UTC] zak@php.net
Thanks for trying the scripts! If we are lucky, this bug report will help us find what weird thing makes $PHP_SELF behave strangely under Win32. Could you please try the same test with a different global value?
[6 Dec 2001 8:40am UTC] v dot puttrich at digitalliquid dot de
zak: I have set up a webserver and ftp for you to do the tests you need. The account is running on the system which produces the problem. Feel free to use it as you like. NOTE: The server might be offline for a short while sometimes. This is because of redialing and submitting a new IP to DynDNS.org every 24 hours. Additionally the server will be down on Sunday, 12/9/01 00:00:00 Am to 10:00:00 Am european time. If you should have additional questions or wishes related to the account do not hesitate to ask me. HTTP and FTP: phpnet.homeip.net The password for the FTP will reach you by email.
[6 Dec 2001 8:46am UTC] v dot puttrich at digitalliquid dot de
Forgot to say this: Please let me know if you find the problem ; )
[6 Dec 2001 8:51am UTC] v dot puttrich at digitalliquid dot de
I'm unable to reach you at "zak@php.net"! Where should I send the password to?
[31 Dec 2001 7:18pm UTC] zak@php.net
I should really get around to examining this. :)
[31 Dec 2001 7:41pm UTC] zak@php.net
Hi Volker, Thanks for setting up the web server for me. It made testing a lot faster. Thankfully, I could not reproduce the problem on your web server. Flagging bug as bogus. For proof of bogosity, see : http://phpnet.homeip.net/v1.php http://phpnet.homeip.net/v2.php http://phpnet.homeip.net/v1.phps http://phpnet.homeip.net/v2.phps Also, here is a diff out the output of calling v2.php directly and calling it via an include call in v1.php None of the globals are missing in either case. Additionally, the two are almost the same -- except for the differences noted below. --- v1.php Mon Dec 31 17:35:12 2001 +++ v2.php Mon Dec 31 17:35:02 2001 @@ -1,5 +1,5 @@ <pre> -PHP_SELF: /v1.php +PHP_SELF: /v2.php <hr><b>ALLUSERSPROFILE:</b> string(42) "C:\\Dokumente und Einstellungen\\All Users" <hr><b>CommonProgramFiles:</b> string(33) "C:\\Programme\\Gemeinsame Dateien" @@ -36,8 +36,8 @@ <hr><b>HTTP_X_FORWARDED_FOR:</b> string(13) "207.34.113.45" <hr><b>PATH:</b> string(55) "C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem" <hr><b>REMOTE_ADDR:</b> string(13) "207.34.94.239" -<hr><b>REMOTE_PORT:</b> string(5) "51995" -<hr><b>SCRIPT_FILENAME:</b> string(27) "d:/www/phpnet/htdocs/v1.php" +<hr><b>REMOTE_PORT:</b> string(5) "51252" +<hr><b>SCRIPT_FILENAME:</b> string(27) "d:/www/phpnet/htdocs/v2.php" <hr><b>SERVER_ADDR:</b> string(14) "217.224.230.39" <hr><b>SERVER_ADMIN:</b> string(11) "zak@php.net" <hr><b>SERVER_NAME:</b> string(17) "phpnet.homeip.net" @@ -50,10 +50,10 @@ <hr><b>SERVER_PROTOCOL:</b> string(8) "HTTP/1.0" <hr><b>REQUEST_METHOD:</b> string(3) "GET" <hr><b>QUERY_STRING:</b> string(0) "" -<hr><b>REQUEST_URI:</b> string(7) "/v1.php" -<hr><b>SCRIPT_NAME:</b> string(7) "/v1.php" -<hr><b>PATH_TRANSLATED:</b> string(27) "d:/www/phpnet/htdocs/v1.php" -<hr><b>PHP_SELF:</b> string(7) "/v1.php" +<hr><b>REQUEST_URI:</b> string(7) "/v2.php" +<hr><b>SCRIPT_NAME:</b> string(7) "/v2.php" +<hr><b>PATH_TRANSLATED:</b> string(27) "d:/www/phpnet/htdocs/v2.php" +<hr><b>PHP_SELF:</b> string(7) "/v2.php" <hr><b>argv:</b> array(0) { } <hr><b>argc:</b> int(0) @@ -95,9 +95,9 @@ ["REMOTE_ADDR"]=> string(13) "207.34.94.239" ["REMOTE_PORT"]=> - string(5) "51995" + string(5) "51252" ["SCRIPT_FILENAME"]=> - string(27) "d:/www/phpnet/htdocs/v1.php" + string(27) "d:/www/phpnet/htdocs/v2.php" ["SERVER_ADDR"]=> string(14) "217.224.230.39" ["SERVER_ADMIN"]=> @@ -124,13 +124,13 @@ ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> - string(7) "/v1.php" + string(7) "/v2.php" ["SCRIPT_NAME"]=> - string(7) "/v1.php" + string(7) "/v2.php" ["PATH_TRANSLATED"]=> - string(27) "d:/www/phpnet/htdocs/v1.php" + string(27) "d:/www/phpnet/htdocs/v2.php" ["PHP_SELF"]=> - string(7) "/v1.php" + string(7) "/v2.php" ["argv"]=> array(0) { }
