markshust / docker-magento

Mark Shust's Docker Configuration for Magento
https://m.academy/courses/set-up-magento-2-development-environment-docker/
MIT License
2.52k stars 995 forks source link

setup-composer-auth => syntax error #628

Closed hans2103 closed 2 years ago

hans2103 commented 2 years ago

Description I receive an error when trying to execute bin/setup-composer-auth

Steps To Reproduce

$ git:(main) bin/setup-composer-auth
Warning: You should avoid overwriting already defined auth settings for github.com.
{"username":"blabla","password":"blabla"}
bash: line 2: syntax error near unexpected token `('
bash: line 2: `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 phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112'
Composer auth has been setup.
$

Expected Result

Actual Result

hans2103 commented 2 years ago

I executed this command to find out another issue. When I execute bin/composer update --prefer-source -vvv at a certain point I have to provide my Github OAuth... every time

Could not fetch https://api.github.com/repos/symfony/event-dispatcher/zipball/3ccfcfb96ecce1217d7b0875a0736976bc6e63dc, please review your configured GitHub OAuth token or enter a new one to access private repos
Executing command (CWD): hostname
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+e2a3e903f3cb+2022-01-28+2032
to retrieve a token. It will be stored in "/var/www/html/auth.json" for future use by Composer.
Token (hidden): 

Trying to find out the issue I executed bin/setup-composer-auth and stumbled upon the mentioned issue

markshust commented 2 years ago

Thanks for the report @hans2103.

I think your first issue may be specific to your install? The error seems to be triggered by the Symfony\Component\Console\Helper\HelperSet::getIterator() function, which doesn't have anything to do with docker-magento. Please correct me if I'm wrong.

As far as the second issue, it seems I've always had an issue persisting the Composer auth key & secret, so that could definitely be an issue. I'll keep this file open and see if anyone else can replicate it?

hans2103 commented 2 years ago

First issue A collegae of mine pointed me to the exact same issue in Symfony Drupal https://github.com/symfony/symfony/issues/42199 I had to change my PHP from 8.1 back to 8.0 or 7.4 to get it working again.

Second issue... I hope anyone else can replicate it too.

khoimm92 commented 2 years ago

That Symfony package has pushed a fix for PHP 8.1 here https://github.com/symfony/console/commit/9a4fcecbcccf4b55f4c28e1c71e3cd83d7be99b8 Temporarily update "symfony/console": "~5.4.0" in the composer.json may pass this error. Or temporarily modify vendor/symfony/console/Helper/HelperSet.php, search & replace this function:

/**
  * @return \Traversable<string, Helper>
  */
 #[\ReturnTypeWillChange]
 public function getIterator()
 {
     return new \ArrayIterator($this->helpers);
 }
markshust commented 2 years ago

Since this appears to not be an issue with this project, I'm closing this one out.