From 01a7991bd52367fcb5eb1617950a9163899d8a80 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 4 Apr 2012 16:57:18 -0500 Subject: [PATCH] fix artisan. --- laravel/cli/artisan.php | 11 +++++++++++ laravel/core.php | 38 +++++++++++++++++++++++++++++++++++++- laravel/laravel.php | 36 ------------------------------------ 3 files changed, 48 insertions(+), 37 deletions(-) diff --git a/laravel/cli/artisan.php b/laravel/cli/artisan.php index a838f8e0..44bb39ab 100644 --- a/laravel/cli/artisan.php +++ b/laravel/cli/artisan.php @@ -2,6 +2,7 @@ use Laravel\Bundle; use Laravel\Config; +use Laravel\Request; /** * Fire up the default bundle. This will ensure any dependencies that @@ -20,6 +21,16 @@ if (isset($_SERVER['CLI']['DB'])) Config::set('database.default', $_SERVER['CLI']['DB']); } +/** + * Overwrite the HttpFoundation request since we have set some of + * the server variables since it was created. This allows us to + * set the default database for the CLI task. + */ + +use Symfony\Component\HttpFoundation\LaravelRequest as RequestFoundation; + +Request::$foundation = RequestFoundation::createFromGlobals(); + /** * We will register all of the Laravel provided tasks inside the IoC * container so they can be resolved by the task class. This allows diff --git a/laravel/core.php b/laravel/core.php index 2606b91f..69133ca5 100644 --- a/laravel/core.php +++ b/laravel/core.php @@ -161,4 +161,40 @@ $bundles = require path('app').'bundles'.EXT; foreach ($bundles as $bundle => $config) { Bundle::register($bundle, $config); -} \ No newline at end of file +} + +/* +|-------------------------------------------------------------------------- +| 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 +|-------------------------------------------------------------------------- +| +| Laravel uses the HttpFoundation Symfony component to handle the request +| and response functionality for the framework. This allows us to not +| worry about that boilerplate code and focus on what matters. +| +*/ + +use Symfony\Component\HttpFoundation\LaravelRequest as RequestFoundation; + +Request::$foundation = RequestFoundation::createFromGlobals(); \ No newline at end of file diff --git a/laravel/laravel.php b/laravel/laravel.php index 665b8538..1dd4eb78 100644 --- a/laravel/laravel.php +++ b/laravel/laravel.php @@ -55,42 +55,6 @@ 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 -|-------------------------------------------------------------------------- -| -| Laravel uses the HttpFoundation Symfony component to handle the request -| and response functionality for the framework. This allows us to not -| worry about that boilerplate code and focus on what matters. -| -*/ - -use Symfony\Component\HttpFoundation\LaravelRequest as RequestFoundation; - -Request::$foundation = RequestFoundation::createFromGlobals(); - /* |-------------------------------------------------------------------------- | Start The Application Bundle