简体   繁体   中英

Enable register_globals in PHP 5.6

I have a website that uses register_globals. My local php version is 5.6. I know that register_globals is DEPRECATED since PHP 5.3.0 and REMOVED in PHP 5.4. But i have to make it work on PHP 5.6, Is there any way to make it work? And is there any problem when i develop on PHP 5.6 and deploy it to production which is use PHP 5.2? Thank you

It is not possible to enable as feature of PHP, but I have developed a library to emulate register_globals .

merciful_polluter emulate register_globals and magic_quotes_gpc (Both were removed in PHP 5.4)

<?php
/**
 * example.com/?foo=3&bar=12
 */

(new Gongo\MercifulPolluter\Requst)->pollute();

global $foo, $bar;
var_dump($foo, $bar);

/**
 * int(3)
 * int(12)
 */

Support PHP versions are 5.4, 5.5, 5.6 and 7.0.

CAUTION: This library is just a emulator

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM