MercifulPolluter (Emulate register_globals on PHP 5.4 or higher)
gongo/merciful-polluter - Packagist
What's this?
MercifulPolluter
emulate register_globals and magicquotesgpc that has been removed since PHP 5.4.
Usage
<?php
/**
* example.com/?foo=3&bar=12
*/
(new Gongo\MercifulPolluter\Requst)->pollute();
global $foo, $bar;
var_dump($foo, $bar);
/**
* int(3)
* int(12)
*/
If use the session, call Gongo\MercifulPolluter\Session::pollute()
after session_start()
:
session_start();
/**
* $_SESSION['user_id'] = 'gongo'
*/
(new Gongo\MercifulPolluter\Session)->pollute();
var_dump($user_id); // string(5) "gongo"
// Reference global variables to session.
$user_id = 'taro';
var_dump($_SESSION['user_id']);
// string(4) "taro"
More informations
See GitHub gongo/merciful-polluter
Written by Wataru MIYAGUNI
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#