Closed cozilic closed 4 years ago
The error message is right. You can't use [] for reading. If you call $foo[]
outside of the left hand side of an assignment, it's a fatal error.
In this case, PsySH (the underlying library in Tinker) should have caught this and prevented it from closing though. This is now fixed in https://github.com/bobthecow/psysh/commit/ba7e315cf26389e8c111b6179aa814c3feb7e833 🙂
Thanks @bobthecow. Can we expect the stuff on the develop branch to be released soon? Anything I can do to help?
Description:
Getting "Symfony\Component\ErrorHandler\Error\FatalError" when using only one command.
Steps To Reproduce:
open tinker, write
Symfony\Component\ErrorHandler\Error\FatalError
Cannot use [] for reading
at C:\laragon\www\Woodchuck\vendor\psy\psysh\src\ExecutionLoopClosure.php:55 51| // Convert all errors to exceptions 52| \set_error_handler([$psysh, 'handleError']); 53| 54| // Evaluate the current code buffer
Whoops\Exception\ErrorException
Cannot use [] for reading
at C:\laragon\www\Woodchuck\vendor\psy\psysh\src\ExecutionLoopClosure.php:55 51| // Convert all errors to exceptions 52| \set_error_handler([$psysh, 'handleError']); 53| 54| // Evaluate the current code buffer
1 C:\laragon\www\Woodchuck\vendor\filp\whoops\src\Whoops\Run.php:408 Whoops\Run::handleError("Cannot use [] for reading", "C:\laragon\www\Woodchuck\vendor\psy\psysh\src\ExecutionLoopClosure.php(55) : eval()'d code")
2 [internal]:0 Whoops\Run::handleShutdown()