|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-06-30 09:26 UTC] m dot rondini at tigersecurity dot it
Description:
------------
test1.php
[CODE]
<?php
$GLOBALS["_REQUEST"]["test"] = "request";
$GLOBALS["_GET"]["test1"] = "get";
?>
[/CODE]
test2.php
[CODE]
<?php
echo $_REQUEST["test"];
echo "<br />";
echo $_GET["test1"];
?>
[/CODE]
.htaccess
[CODE]
php_value auto_prepend_file ./test1.php
[/CODE]
with this scenario, the only printed variable is $_GET["test1"] . However, if I
append "print_r($_REQUEST);" in test1.php, it work.
Expected result:
----------------
request
get
Actual result:
--------------
get
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 06:00:01 2025 UTC |
Super-Globals ($_GET / $_REQUEST / $_SESSION / ...) are optimized that they are only provided if the parser detects them being used. If you write $GLOBALS["_REQUEST"] only this won't be detected. You can fix the issue by writing $_REQUEST["test"] = "request"; $_GET["test1"] = "get"; or by setting auto_globals_jit=0 in php.ini The only way we could fix it is by always providing all super-globals in every context which is a notable performance hit.why, if i use "require('test1.php');" in test2.php, work it fine? After prepend "require", the return is "request<br />get", how i would see. But, using auto_prepend_file, something wrong. Is It a bug or other?