Fatal error: Method Respect\Rest\Router::__toString()
Closed this issue · 2 comments
Hey all,
i've updated my php version to 7.1.10 and in my app i received the following error:
Fatal error: Method Respect\Rest\Router::__toString() must not throw an exception, caught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /my-folder/vendor/respect/rest/library/Respect/Rest/Router.php on line 0
Function -> Respect\Rest\Router->__destruct( )
Location -> .../Router.php
Somebody could help me plz?
Answer is easy as stealing candy from kids.
In my router i forgot to put 'null' in my parameters.
Causes error:
$router->any('/my-page///', function ($arg1,$arg2){}
Correct way:
$router->any('/my-page///', function ($arg1=null,$arg2=null){}
Hope it helps someone.
Query answered...