Created
October 30, 2010 22:56
-
-
Save pix0r/655839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Added to override the default parse_str(php://input) | |
*/ | |
if (!empty($_SERVER['REQUEST_METHOD']) | |
&& in_array($_SERVER['REQUEST_METHOD'], array('GET', 'POST')) === false | |
&& empty($_POST)) { | |
// Store original request | |
$input = file_get_contents('php://input'); | |
// Maintain compatibility with standard key/value data format | |
parse_str($input, $_POST); | |
// Store original data in $_POST[data] | |
$_POST['RAW_DATA'] = $input; | |
unset($input); | |
// Save this for later; it will be clobbered by Request::instance() | |
$_POST_save = $_POST; | |
} | |
/** | |
* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO']. | |
* If no source is specified, the URI will be automatically detected. | |
*/ | |
$request = Request::instance(); | |
/** | |
* In the event that Request::instance() clobbers $_POST, restore it | |
*/ | |
if (!empty($_POST_save) && count($_POST_save) > count($_POST)) { | |
$_POST = $_POST_save; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment