php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20431 function generated include blocks access to $HTTP_GET_VARS[]
Submitted: 2002-11-14 13:29 UTC Modified: 2002-11-14 15:29 UTC
From: remi2402 at hotmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.3 OS: Windows XP Pro
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: remi2402 at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-11-14 13:29 UTC] remi2402 at hotmail dot com
My script uses multiple includes and the file names all have the same syntax. So instead of writing each individual include, I created an array which contains all the filenames

function LoadSections($sections)
{
	foreach ($sections as $key => $value)
	{
		include "mod.section." . $value . ".php";
	}
}

All the files load well except that I cannot access HTTP_GET_VARS and the isset() function always return false.

NB My includes work fine when loaded individually

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-14 13:30 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.
 [2002-11-14 13:36 UTC] remi2402 at hotmail dot com
Then how come the isset function doesn't work with these includes?
 [2002-11-14 13:47 UTC] remi2402 at hotmail dot com
I know you bogusified my report, but it doesn't make sense. I'm just telling PHP to write itself what I would normally write. How can this block the isset function and the _GET array?
 [2002-11-14 15:29 UTC] philip@php.net
Your example is including files inside a function so the included files follow standard variable scope rules.  This is why this is marked as a bogus bug and a support question.

function foo() {
  $var = 'blah';
}
foo(); var_dump($var); // NULL

$_GET will still be available as it's an autoglobal while  $HTTP_GET_VARS will not.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 16:01:28 2024 UTC