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

Deprecation notices with PHP 8.1 #10008

Closed
sebastianbergmann opened this issue Jul 20, 2021 · 16 comments
Closed

Deprecation notices with PHP 8.1 #10008

sebastianbergmann opened this issue Jul 20, 2021 · 16 comments
Labels
Milestone

Comments

@sebastianbergmann
Copy link

From https://github.com/sebastianbergmann/phpunit/runs/3111696987:

Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count()
should either be compatible with Countable::count(): int,
or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
in phar:///home/runner/work/phpunit/phpunit/tools/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count()
should either be compatible with Countable::count(): int,
or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
in phar:///home/runner/work/phpunit/phpunit/tools/composer/src/Composer/Repository/WritableArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count()
should either be compatible with Countable::count(): int,
or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
in phar:///home/runner/work/phpunit/phpunit/tools/composer/src/Composer/Repository/InstalledFilesystemRepository.php:286 

Related

@Seldaek
Copy link
Member

Seldaek commented Jul 22, 2021

@shivammathur sorry to nag you but as I've been wondering this for a while, I figured this is as good a time as any to ask.. What's the timeline on getting new composer releases to be included by setup-php? Is it dependent on some manual build step you have to do? Is there anything I could do to speed this up?

I just released 2.1.4 which fixes 8.1 deprecations and it'd be great to get it out to GH actions :)

@Seldaek
Copy link
Member

Seldaek commented Jul 22, 2021

@shivammathur Similarly, I have now tried switching to tools: composer:snapshot but it seems I get the snapshot from some-time-yesterday and not the latest. It'd be great if snapshot would force it to download the latest always at least and not use the latest container you've built.

@stof
Copy link
Contributor

stof commented Jul 22, 2021

@Seldaek Looking at the setup-php code, it downloads it from https://github.com/shivammathur/composer-cache, which is updated by a cron once a day

@shivammathur
Copy link

shivammathur commented Jul 22, 2021

@Seldaek
Composer builds are cached to GitHub releases by a daily cron workflow. This cache is used to download composer phars with getcomposer.org as a fallback. This was done as there were random network issues while fetching composer. Using a GitHub releases cache reduces the setup time as well because of server location.

I think a good solution would be adding a flag in setup-php to not use the cache, but use getcomposer.org as the source.

@stof
Copy link
Contributor

stof commented Jul 22, 2021

@shivammathur another thing might also be to increase the frequency of the cron updating the cache (the snapshot on getcomposer.org is not updated only nightly, but when there is activity in the composer repo)

@Seldaek
Copy link
Member

Seldaek commented Jul 22, 2021

Right if that was updated hourly for example that would completely solve the issue IMO.

@shivammathur
Copy link

@Seldaek I will update the cron, and add the flag in the next release.

@MarkBaker
Copy link

MarkBaker commented Jul 22, 2021

I'm getting deprecation notices with 8.1 as well:

PHP 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
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/WritableArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/InstalledFilesystemRepository.php:286
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
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
/home/runner/.cache/composer/files

I'm not sure that these are directly related though, and if your changes will resolve my deprecation notices

The above was output from

composer config cache-files-dir

@shivammathur
Copy link

shivammathur commented Jul 22, 2021

@MarkBaker Please re-run your workflow, setup-php should now install composer 2.1.4 which will not have these notices.

@Seldaek
Copy link
Member

Seldaek commented Jul 22, 2021

@Seldaek I will update the cron, and add the flag in the next release.

Thanks for the prompt fix as always!

@sebastianbergmann
Copy link
Author

PHP 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
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/WritableArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/InstalledFilesystemRepository.php:286
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
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
/home/runner/.cache/composer/files

I'm not sure that these are directly related though, and if your changes will resolve my deprecation notices

The above was output from

composer config cache-files-dir

This is tracked elsewhere:

@stratboy
Copy link

Having same notices here, and I didn't really understand how to solve.. Any easy explanation? :) Thank you

@Pezhvak
Copy link

Pezhvak commented Jan 26, 2022

It seems the merge didn't fix the issue, after upgrading to 8.1 i'm still getting the deprecation notice.

@Seldaek
Copy link
Member

Seldaek commented Jan 26, 2022

Please create a new issue with more details.. Saying "me too" when something has been fixed for over six months and nobody had a problem clearly indicates this is either some other issue, or you're doing something wrong in your environment and not using the fix. None of which is going to be solved by writing here that you have the same problem.

@stratboy
Copy link

Please create a new issue with more details.. Saying "me too" when something has been fixed for over six months and nobody had a problem clearly indicates this is either some other issue, or you're doing something wrong in your environment and not using the fix. None of which is going to be solved by writing here that you have the same problem.

Honestly, I really didn't understand what the fix should be. None of the aswers seems to explain it step by step. At least to me. I'm not a shell expert. Simply composer has always worked, until I updated system php to v8. Then composer should still work, at least after updating it.

@Seldaek
Copy link
Member

Seldaek commented Jan 26, 2022

Composer should work yes, if you use a version which is compatible with PHP 8.1.. I don't know what version you are using as you provided no details whatsoever. If you opened a new issue and follow the issue template I may have enough info to help you. How about doing that instead of arguing here?

@composer composer locked as resolved and limited conversation to collaborators Jan 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants