php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12800 QUERY_STRING disappears inside function bodies
Submitted: 2001-08-16 16:44 UTC Modified: 2001-08-16 16:52 UTC
From: Frank dot Cornelis at rug dot ac dot be Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.0.6 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Frank dot Cornelis at rug dot ac dot be
New email:
PHP Version: OS:

 

 [2001-08-16 16:44 UTC] Frank dot Cornelis at rug dot ac dot be
In next PHP page test.php something weird happens:
<html><body>
<% // using asp_tags
	print "before call: $QUERY_STRING <br>";
	function do_it () {
		print "inside: $QUERY_STRING <br>";
	}
	do_it ();
	print "after call: $QUERY_STRING <br>";
%>
Note: variables comming from register_globals also
disappear inside the function.
<form action="test.php" method="get">
<input type="hidden" name="name" value="value">
<input type="button" value="< go back" onClick="history.back()">
<input type="submit" value="do it">
</form>
</body></html>

If it is the normal behavior of PHP to make the QUERY_STRING disappear inside function bodies, then please document it in the PHP manual. If it's really a bug...that's bad.

Please, let me know something asap.

Frank.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-16 16:52 UTC] rasmus@php.net
It is documented in the section on variable scope that you have to use the 'global' keyword to access a global variable from inside a function.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC