Skip to content

app()->call('class@method', $parameter); call the method with one more extra parameter #26837

Closed
@imanghafoori1

Description

@imanghafoori1
  • Laravel Version: 5.5.44
  • PHP Version: 7.2.9
  • Database Driver & Version:

Description:

it seems when I use app()->call(... and I pass the second argument as an array of parameters
in case the parameters array begins with a closure the actual the method is called with wrong parameters.
the first parameters becomes an empty sting and the rest are the actual parameters.

The actual parameters passed into app()->call is like this :
image

but it seems laravel IOC adds an empty string at the beginning of the array and the method is called with 3 arguments in this case.

Steps To Reproduce:

  1. you can clone the https://github.com/imanghafoori1/laravel-heyman repo
  2. check out the devel branch.
  3. composer install

see :
Imanghafoori\HeyMan\Conditions\ConditionsFacade class at line 12
and
Imanghafoori\HeyMan\Conditions\Traits\Callbacks line 9

see the comments there as a hint

run the tests and they pass

if you remove the $emptyString parameter from 'closureAllows' and 'methodAllows' method tests fail.
there is no reason for that parameter to exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions