Home > Enterprise >  Composer: Installing Symfony/mailer dies with errors
Composer: Installing Symfony/mailer dies with errors

Time:07-08

I am relatively inexperienced with Composer. I am attempting to migrate from the EOL Swiftmailer package to using Symfony/mailer using directions from https://doeken.org/blog/using-symfony-mailer-without-framework

None of the related questions on SO seem to be same issue.

Server is Debian 10 (buster); PHP 8.1.7 (cli) built: Jun 25 2022; Composer 1.8.4.

composer init -n --name symfony-mailer-test succeeds in my new test directory though deprecation warnings are thrown. composer.json is created with the namespace set.

{ "name": "symfony-mailer-test", "require": {} }

Then issuing composer require symfony/mailer install dies with

Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): Composer\DependencyResolver\DefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(742): Composer\DependencyResolver\Solver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): Composer\DependencyResolver\Solver->runSat()
#5 /usr/share/php/Composer/Installer.php(475): Composer\DependencyResolver\Solver->solve()
#6 /usr/share/php/Composer/Installer.php(229): Composer\Installer->doInstall()
#7 /usr/share/php/Composer/Command/RequireCommand.php(196): Composer\Installer->run()
#8 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): Composer\Command\RequireCommand->execute()
#9 /usr/share/php/Symfony/Component/Console/Application.php(953): Symfony\Component\Console\Command\Command->run()
#10 /usr/share/php/Symfony/Component/Console/Application.php(248): Symfony\Component\Console\Application->doRunCommand()
#11 /usr/share/php/Composer/Console/Application.php(258): Symfony\Component\Console\Application->doRun()
#12 /usr/share/php/Symfony/Component/Console/Application.php(148): Composer\Console\Application->doRun()
#13 /usr/share/php/Composer/Console/Application.php(104): Symfony\Component\Console\Application->run()
#14 /usr/bin/composer(57): Composer\Console\Application->run()
#15 {main}
  thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84

composer.json is updated before it dies to

    "name": "symfony-mailer-test",
    "require": {
        "symfony/mailer": "^6.1"
    }
}

composer -V also produces errors now:


Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator()                                                            : Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Console                                                            /Helper/HelperSet.php on line 104
Deprecation Notice: Optional parameter $schema declared before required parameter $path is implicitly treated as a required parameter in /usr/share/ph                                                            p/JsonSchema/Constraints/UndefinedConstraint.php:62
Deprecation Notice: Optional parameter $schema declared before required parameter $path is implicitly treated as a required parameter in /usr/share/ph                                                            p/JsonSchema/Constraints/UndefinedConstraint.php:108
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/share/php/JsonSchema/Constraints/Constraint.                                                            php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\Re                                                            turnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:196
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\Re                                                            turnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:196
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\Re                                                            turnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:196
Deprecation warning: Your package name symfony-mailer-test is invalid, it should have a vendor name, a forward slash, and a package name. The vendor a                                                            nd package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9] )*/[a-z0-9]([_.-]?[a-z0-9] )*". Make sure                                                             you fix this as Composer 2.0 will error.
Deprecation Notice: Return type of Symfony\Component\Process\Process::getIterator($flags = 0) should either be compatible with IteratorAggregate::getI                                                            terator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Componen                                                            t/Process/Process.php:572
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Composer 1.8.4 2019-02-11 10:52:10

This is such a basic operation that I do not know how to begin debugging it. What should my next step be?

CodePudding user response:

You can try composer self-update.

Current Composer version 2.3.8 2022-07-01 12:10:47.

CodePudding user response:

Probably you have memory limit for the CLI config, try

php -d "memory_limit=-1" $(which composer) require symfony/mailer

To avoid warnings of the composer -V update it to the latest version.

  • Related