diff --git a/changelog.md b/changelog.md index f5392173..9652e9a5 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ ## Version 2.0.4 - Feature: Added default parameter to File::get method. - Feature: Allow for message container to be passed to Redirect's "with_errors" method. - Fix: Lowercase HTTP verbs may be passed to Form::open method. +- Fix: Filter parameters are now merged correctly. ### Upgrading from 2.0.3 diff --git a/laravel/routing/filter.php b/laravel/routing/filter.php index a3d4acb7..48eb829a 100644 --- a/laravel/routing/filter.php +++ b/laravel/routing/filter.php @@ -26,27 +26,31 @@ public static function register($filters) * Call a filter or set of filters. * * @param array|string $filters - * @param array $parameters + * @param array $pass * @param bool $override * @return mixed */ - public static function run($filters, $parameters = array(), $override = false) + public static function run($filters, $pass = array(), $override = false) { foreach (static::parse($filters) as $filter) { + $parameters = array(); + // Parameters may be passed into routes by specifying the list of // parameters after a colon. If parameters are present, we will // merge them into the parameter array that was passed to the // method and slice the parameters off of the filter string. if (($colon = strpos($filter, ':')) !== false) { - $parameters = array_merge($parameters, explode(',', substr($filter, $colon + 1))); + $parameters = explode(',', substr($filter, $colon + 1)); $filter = substr($filter, 0, $colon); } if ( ! isset(static::$filters[$filter])) continue; + $parameters = array_merge($pass, $parameters); + $response = call_user_func_array(static::$filters[$filter], $parameters); // "Before" filters may override the request cycle. For example,