Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7019833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:14:13+00:00 2026-05-27T23:14:13+00:00

PROBLEM So, I have this function to retrieve and proceed data from $_REQUEST, $_POST,

  • 0

PROBLEM

So, I have this function to retrieve and proceed data from $_REQUEST, $_POST, $_GET or $_COOKIE arrays. I know which array to use only from function call. Simplified ex:

function gg( $name, $type="_REQUEST" ) {
    return isset( $GLOBALS[$type][$name] ) ? $GLOBALS[$type][$name] : false;
}

And it works perfectly for calls like:

gg('var', '_GET');
gg('var2', '_POST');

But fails dramatically for:

gg('var');
// or
gg('var', '_REQUEST');

I managed to simplify this problem thou to 2 lines:

print_r( $GLOBALS['_REQUEST'] ); // this line returns nothing...
print_r( $_REQUEST ); // ...UNLESS this line is present anywhere in the code

Now, my obvious question is: Is there any necessity to initialize this $_REQUEST array to be present in $GLOBALS?

additional info:

php: 5.3.3-7
apache: 2.2.16

also I'm running on CGI/FastCGI

EDIT & SOLUTION

1

As found here the easiest solution would be to edit php.ini and change there value of auto_globals_jit from On to Off.

auto_globals_jit Off

2

Instead of this you can use ini_set() inside of your source file, however it didn’t work for me…

ini_set("auto_globals_jit", "Off");

3

Yet another solution is to use $GLOBALS array to everything except $_REQUEST and for $_REQUEST requests call directly to $_REQUEST array 😀

if($type == "REQUEST") return $_REQUEST[$name];
else return ${"_".$type}[$name]; // or $GLOBALS["_".$type][$name] if previous won't work
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:14:13+00:00Added an answer on May 27, 2026 at 11:14 pm

    Couldn’t replicate this on my setup so it could possibly be CGI issue? As a workaround you could do something like this…

    function gg( $name, $type="_REQUEST" ) {
        return isset( ${$type}[$name] ) ? ${$type}[$name] : false;
    }
    

    Might be of interest:

    As of PHP 5.4 $GLOBALS is now initialized just-in-time. This means
    there now is an advantage to not use the $GLOBALS variable as you can
    avoid the overhead of initializing it. http://www.php.net/manual/en/reserved.variables.globals.php

    Update. See Post:

    $_REQUEST not created when using variable variables?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function to read in all ints from the file. The problem
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
Hello I have a problem to retrieve a value from a method. I'm using
I have a problem where I retrieve and element from a list (list1), and
I have a problem with this function: $(#contentdiv).click(function() { $(this).append(<div class='editable'>For some reason this
I have a function to retrieve a single row of data representing a sales
I have a serious problem. Firstly, I am trying to retrieve values from my
I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
I have a problem with a javascript set of functions that I made. This
I have this problem I'm hoping someone knows the answer to. I have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.