fix filter parameter merging bug and update changelog.

This commit is contained in:
Taylor Otwell 2011-12-03 23:09:47 -06:00
parent 4c3ffcef52
commit 1c97dccaef
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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,