Skip to content

Conversation

@driesvints
Copy link
Member

This PR fixes an issue where a change in Laravel 9 broke command resolving. The culprit is laravel/framework#34873 which adds support for lazy loading. The change causes a null value to be returned for commands which are suppose to be lazy loaded and therefor these commands were never resolved or added to the Tinker session.

The fix I'm attempting is to use the Laravel container instance instead of the console application. What we want to achieve is to resolve all commands beforehand and add them to the Psysh shell session. Afaik Psysh has no way of handling lazy loaded commands. Therefor we need to resolve them all beforehand.

All commands started working again when I did this change. I do not know of any side effects from making this change.

Fixes #143

@taylorotwell taylorotwell merged commit eecc92b into 2.x Mar 15, 2022
@taylorotwell taylorotwell deleted the fix-command-loading branch March 15, 2022 13:35
@michaelhume
Copy link
Contributor

When attempting to implement the fix locally, the issue of loading commands from config/tinker.php seems to persist. It appears getLaravel()->resolve() is private

Call to protected method Illuminate\Foundation\Application::resolve() from scope Laravel\Tinker\Console\TinkerCommand

@driesvints
Copy link
Member Author

Fixed, thanks

@michaelhume
Copy link
Contributor

Fixed, thanks

@driesvints can you share the new fix?

@driesvints
Copy link
Member Author

Last commit on the repos main branch

@Brenneisen
Copy link

Brenneisen commented Mar 16, 2022

Hi @driesvints, I get the following error when running custom commands with laravel/tinker 2.7.1 and laravel/framework 9.5.1. With 2.7.0 it still works. Seems to be related to this fix.

PHP Error: Call to a member function make() on null in /home/vagrant/workspace/Falcon/backend/vendor/laravel/framework/src/Illuminate/Console/Command.php on line 116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue registering StorageLinkCommand

5 participants