Search code examples
phpdirectivephp-7php-iniregister-globals

Is the PHP directive entry 'register_globals' has been completely removed from the php.ini(The PHP configuration file) as of PHP 7.1.12?


I'm using PHP 7.1.12 using XAMPP on Windows 10 operating system.

Today, I was just checking the output of phpinfo() in my web browser and surprisingly I no where found an entry for the directive register_globals in it.

Almost on 70% of its pages, the PHP Manual mentions this directive register_globals has been deprecated and should not be used but I can't even see the respective entry in php.ini file. So, is the respective entry has been completely removed from the PHP distribution?

Also, let me know whether old $HTTP_*_VARS arrays are accessible to me i.e. in PHP 7.1.12 or not or they also have been removed from the PHP distribution?


Solution

  • register_globals has been removed around PHP5.4, you an still simulate the behaviour but it is a bad practice.

    You can emulate its behavior by adding a function call to a user-written register_globals() function like this: https://pageconfig.com/post/register_globals-is-back-php-implementation

    Or by prepending a user-written script to every executed php files, like this: http://www.kaffeetalk.de/using-register_globals-in-php-5-5/

    $HTTP_GET_VARS is called simply $_GET now, same for $POST, and most of the old $HTTP*_VARS has new names as well, most of the time it will only take a simple replace in path to migrate, but otherwise the whole structure got removed in PHP5.4: http://php.net/manual/en/tutorial.useful.php