Skip to content

Commit

Permalink
If arguments more than one returns only first
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Pupinin committed Feb 15, 2016
1 parent 39e8955 commit 416cbab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Auth/Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ protected function callAuthCallback($user, $ability, array $arguments)
*/
protected function callBeforeCallbacks($user, $ability, array $arguments)
{
$arguments = array_merge([$user, $ability], $arguments);
$arguments = array_merge([$user, $ability], [$arguments]);

foreach ($this->beforeCallbacks as $before) {
if (! is_null($result = call_user_func_array($before, $arguments))) {
Expand All @@ -299,7 +299,7 @@ protected function callBeforeCallbacks($user, $ability, array $arguments)
*/
protected function callAfterCallbacks($user, $ability, array $arguments, $result)
{
$arguments = array_merge([$user, $ability, $result], $arguments);
$arguments = array_merge([$user, $ability, $result], [$arguments]);

foreach ($this->afterCallbacks as $after) {
call_user_func_array($after, $arguments);
Expand Down

1 comment on commit 416cbab

@sebdesign
Copy link
Contributor

@sebdesign sebdesign commented on 416cbab Jun 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this be the same as $arguments = [$user, $ability, $arguments] in the callBeforeCallbacks? Why is array_merge needed here?

Please sign in to comment.