nasirkhan
nasirkhan

Reputation: 10553

Laravel 7 upgrade failing

I was following the Laravel 6.x to Laravel 7.x upgrade doc and made the necessary changes. But it is failing and showing the following error. At the time of running composer update there were not 3rd party packages. Then i installed some other packages and after that tried to update again and stuck at this error.

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Symfony\Component\Process\Process::__construct() must be of the type array, string given, called in phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php on line 65 and defined in /var/www/html/laravel/laravel-starter/vendor/symfony/process/Process.php:140
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php(65): Symfony\Component\Process\Process->__construct(''/usr/bin/php7....', NULL, NULL, NULL, 300)
#1 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(245): Composer\Util\ProcessExecutor->execute(''/usr/bin/php7....')
#2 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(312): Composer\EventDispatcher\EventDispatcher->dispatchScript('post-autoload-d...', true, Array, Array)
#4 phar:///usr/local/bin in /var/www/html/laravel/laravel-starter/vendor/symfony/process/Process.php on line 140

Fatal error: Uncaught TypeError: Argument 1 passed to Symfony\Component\Process\Process::__construct() must be of the type array, string given, called in phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php on line 65 and defined in /var/www/html/laravel/laravel-starter/vendor/symfony/process/Process.php:140
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php(65): Symfony\Component\Process\Process->__construct(''/usr/bin/php7....', NULL, NULL, NULL, 300)
#1 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(245): Composer\Util\ProcessExecutor->execute(''/usr/bin/php7....')
#2 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(312): Composer\EventDispatcher\EventDispatcher->dispatchScript('post-autoload-d...', true, Array, Array)
#4 phar:///usr/local/bin in /var/www/html/laravel/laravel-starter/vendor/symfony/process/Process.php on line 140

Source of the project is available at: https://github.com/nasirkhan/laravel-starter/tree/v7

Upvotes: 2

Views: 3908

Answers (2)

Ilyich
Ilyich

Reputation: 5776

Laravel 7 upgraded Symfony from 4 to 5 and Process syntax changed:

Before:

$process = new Process('ls -l');

After:

$process = new Process(array('ls', '-l'));

You need to adjust your code to the new syntax.

More info here: https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.0.md#process

Upvotes: 1

h-u9732
h-u9732

Reputation: 11

Make sure all of your symfony dependencies are at least 5.0 and that your composer is updated by running composer self-update.

Upvotes: 1

Related Questions