fix filter parameter merging bug and update changelog.
This commit is contained in:
parent
4c3ffcef52
commit
1c97dccaef
|
@ -5,6 +5,7 @@ ## Version 2.0.4
|
||||||
- Feature: Added default parameter to File::get method.
|
- Feature: Added default parameter to File::get method.
|
||||||
- Feature: Allow for message container to be passed to Redirect's "with_errors" 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: Lowercase HTTP verbs may be passed to Form::open method.
|
||||||
|
- Fix: Filter parameters are now merged correctly.
|
||||||
|
|
||||||
### Upgrading from 2.0.3
|
### Upgrading from 2.0.3
|
||||||
|
|
||||||
|
|
|
@ -26,27 +26,31 @@ public static function register($filters)
|
||||||
* Call a filter or set of filters.
|
* Call a filter or set of filters.
|
||||||
*
|
*
|
||||||
* @param array|string $filters
|
* @param array|string $filters
|
||||||
* @param array $parameters
|
* @param array $pass
|
||||||
* @param bool $override
|
* @param bool $override
|
||||||
* @return mixed
|
* @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)
|
foreach (static::parse($filters) as $filter)
|
||||||
{
|
{
|
||||||
|
$parameters = array();
|
||||||
|
|
||||||
// Parameters may be passed into routes by specifying the list of
|
// Parameters may be passed into routes by specifying the list of
|
||||||
// parameters after a colon. If parameters are present, we will
|
// parameters after a colon. If parameters are present, we will
|
||||||
// merge them into the parameter array that was passed to the
|
// merge them into the parameter array that was passed to the
|
||||||
// method and slice the parameters off of the filter string.
|
// method and slice the parameters off of the filter string.
|
||||||
if (($colon = strpos($filter, ':')) !== false)
|
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);
|
$filter = substr($filter, 0, $colon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! isset(static::$filters[$filter])) continue;
|
if ( ! isset(static::$filters[$filter])) continue;
|
||||||
|
|
||||||
|
$parameters = array_merge($pass, $parameters);
|
||||||
|
|
||||||
$response = call_user_func_array(static::$filters[$filter], $parameters);
|
$response = call_user_func_array(static::$filters[$filter], $parameters);
|
||||||
|
|
||||||
// "Before" filters may override the request cycle. For example,
|
// "Before" filters may override the request cycle. For example,
|
||||||
|
|
Loading…
Reference in New Issue