PHP $_SESSION is always empty on the production environment for all function, except one specific function

Viewed 52

Below are functions that print $_SESSION.

public function foo() {
    print($_SESSION); 
}

public function bar() {
    print($_SESSION); 
}

public function anyOtherFunctionName() {
    print($_SESSION); 
}

We are facing a problem that all functions print $_SESSION in the local environment and $_SESSION is not empty for any function. In the production environment, only the foo() function prints $_SESSION containing information. $_SESSION in any other function is always empty.

If we change foo() function name to whatever(), $_SESSION is also empty in the production environment. And if we change the bar() function name to foo() function name on the production environment, $_SESSION which was empty, is not empty anymore.

So, on the production environment $_SESSION is always empty in any function name, except the name foo().

On the local environment, $_SESSION is never empty in any function.

Is it possible that someone can configure some PHP server configuration to always empty $_SESSION if it is not the foo() function? Any idea how we can debug that when $_SESSION is never empty in any function name in local environment?

0 Answers
Related