PHP-EXTRACT-001
extract($_REQUEST)
extract($_GET) / extract($_POST)
extract on superglobals overwrites local variables. It still runs on Joomla 6 and is still wrong.
extract($_REQUEST) → Input API, named variables
Symptoms people search
extract post · variable overwrite
Replace this code
Swap extract($_REQUEST) for Input API, named variables.
Joomla 3
Remove or stop calling this
extract($_POST);
echo $title;Joomla 4 / 6
Use this instead
$title = $app->getInput()->getString('title');How to fix it
- 1Delete extract($_GET/$_POST/$_REQUEST).
- 2Read keys through Input.
Also known as
extract($_POST) · extract($_GET) · extract($_REQUEST)
There is no 1:1 swap for this one. The architecture changed. If you cannot rewrite it, Infyways can.
Related issues
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4PHP
jimport() autoloader calls
jimport('joomla.filesystem.file') → use Joomla\CMS\Filesystem\File;
- Joomla 3 → 4PHP
DS path constant
DS → DIRECTORY_SEPARATOR or /
- Joomla 3 → 4PHP
JPATH_PLATFORM
JPATH_PLATFORM → Do not use — autoload instead
- Joomla 3 → 4PHP
mysql_* PHP functions
mysql_query() → Joomla DatabaseInterface / mysqli / PDO
- Joomla 3 → 4PHP
each() / create_function() / ereg / split
each($array) → foreach / closures / preg_*