diff --git a/laravel/laravel.php b/laravel/laravel.php index 132c683b..9d0ec57a 100644 --- a/laravel/laravel.php +++ b/laravel/laravel.php @@ -55,6 +55,27 @@ register_shutdown_function(function() error_reporting(-1); +/* +|-------------------------------------------------------------------------- +| Magic Quotes Strip Slashes +|-------------------------------------------------------------------------- +| +| Even though "Magic Quotes" are deprecated in PHP 5.3.x, they may still +| be enabled on the server. To account for this, we will strip slashes +| on all input arrays if magic quotes are enabled for the server. +| +*/ + +if (magic_quotes()) +{ + $magics = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); + + foreach ($magics as &$magic) + { + $magic = array_strip_slashes($magic); + } +} + /* |-------------------------------------------------------------------------- | Create The HttpFoundation Request @@ -66,9 +87,9 @@ error_reporting(-1); | */ -use Symfony\Component\HttpFoundation\Request as FoundationRequest; +use Symfony\Component\HttpFoundation\LaravelRequest as RequestFoundation; -Request::$foundation = FoundationRequest::createFromGlobals(); +Request::$foundation = RequestFoundation::createFromGlobals(); /* |-------------------------------------------------------------------------- diff --git a/vendor/Symfony/Component/HTTPFoundation/LaravelRequest.php b/vendor/Symfony/Component/HTTPFoundation/LaravelRequest.php new file mode 100644 index 00000000..f4f135ef --- /dev/null +++ b/vendor/Symfony/Component/HTTPFoundation/LaravelRequest.php @@ -0,0 +1,27 @@ +server->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') + && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH')) + ) { + parse_str($request->getContent(), $data); + if (magic_quotes()) $data = array_strip_slashes($data); + $request->request = new ParameterBag($data); + } + + return $request; + } + +} \ No newline at end of file