0

Using the $_SERVER super global in an extension causes the following guideline error

Direct use of $_SERVER Superglobal detected

I know the alternative for Magento 2 but how do you solve this for Magento 1?

1 Answer 1

0

To access a variable globally, you can use session in magento1.

$session = Mage::getSingleton("core/session");
$session->setData("your_variable", "your value");

// Now you can retrieve your data elsewhere or even after the next request:
$session = Mage::getSingleton("core/session");
$yourVariable = $session->getData("your_variable");
1
  • I'm sorry. I meant server variables like "SERVER_SOFTWARE.
    – alobeejay
    Commented Oct 25, 2018 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.