Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation fails: Invalid argument supplied for foreach() #33

Closed
Leamsi9 opened this issue Feb 17, 2021 · 4 comments
Closed

Installation fails: Invalid argument supplied for foreach() #33

Leamsi9 opened this issue Feb 17, 2021 · 4 comments

Comments

@Leamsi9
Copy link

Leamsi9 commented Feb 17, 2021

When running composer require, it hits this error on api.php line 8. Can't install. Don't have this issue with composer require on any other packages I just tested.

In api.php line 8:
                                           
  Invalid argument supplied for foreach()  
                                           

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
@vyuldashev
Copy link
Owner

Which version?

@Leamsi9
Copy link
Author

Leamsi9 commented Feb 18, 2021

I presume v1.0.3. It happens on composer require vyuldashev/laravel-openapi which I presume installs the latest version?

@vyuldashev
Copy link
Owner

I just tried with a clean installation of Laravel and I see no errors. Do you try to install it to Laravel or Lumen?

@hendrikbl
Copy link

I was getting the same error when I first tried installing into my existing Laravel 8 project.

This happens if the config was cached using php artisan config:cache. After that every call to new config values, inlcluding config('openapi.collections') will return null, thus the error.

The solution is simple: Just run php artisan config:clear and installation will run smoothly. At least it did for me.

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

No branches or pull requests

3 participants