0

The Joomla Extensions Directory puts pressure on developers not to use global variables (superglobals) such as $_SERVER, $_REQUEST, $_POST, $_GET, $_FILES, $_ENV, $_COOKIE, and $_SESSION to prevent SQL injections.

I'm mostly concerned about the $_GET variable which is widely used in my extension. What's the best way of replacing $_GET without having to make too many changes to the application?

Nadeem0035
  • 3,757
  • 1
  • 24
  • 36
Wink
  • 1
  • 1
  • https://stackoverflow.com/q/52526027/2943403 , https://stackoverflow.com/q/45152415/2943403 , https://stackoverflow.com/a/45123677/2943403 – mickmackusa Jan 30 '20 at 07:43

1 Answers1

0

The JApplication Object has a property input which holds all $_POST and $_GET Data for you. It works something like that:

$jinput = $JFactory::getApplication()->input;
$data = $jinput->get('getparamter');

There is plenty of documentation out there for for the use of that input object. Here is the API Documentation

$_SERVER, $_SESSION and others are replaces with userState and similar mechanisms, there really is no need to use of superglobals in Joomla.

user3154108
  • 1,264
  • 13
  • 23