Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tvvocold's avatar

array_merge(): Expected parameter 2 to be an array, int given

Why I got this error after run 'php artisan clear' and how to debug?

$ php artisan clear
> In ServiceProvider.php line 72:
  array_merge(): Expected parameter 2 to be an array, int given

Also, same error when I install something:

$ composer require something
> In ServiceProvider.php line 72:
  array_merge(): Expected parameter 2 to be an array, int given
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Tried composer update, didn't help, same error as well.

BTW I'm using PHP 7.4 with Laravel 5.8

0 likes
3 replies
Sinnbeck's avatar

Which ServiceProvider file is that? Can you see what is on that line?

Nakov's avatar

You should probably check your config folder files and make sure that all of them return an array.

tvvocold's avatar
tvvocold
OP
Best Answer
Level 1

Update: I just delete all the file in the bootstrap/cache and rerun the command and it worked.

1 like

Please or to participate in this conversation.