ecoAPM / php-libyear

A simple measure of dependency freshness
https://libyear.com
MIT License
19 stars 7 forks source link

PHP Warning: Undefined array key "metadata-url" #47

Closed marty-macfly closed 1 year ago

marty-macfly commented 1 year ago

With libyear version 2.1.1 and PHP 8.1 I've got the following error:

PHP Warning:  Undefined array key "metadata-url" in ~/.config/composer/vendor/ecoapm/libyear/src/RepositoryAPI.php on line 31
PHP Fatal error:  Uncaught TypeError: LibYear\Repository::__construct(): Argument #2 ($metadata_pattern) must be of type string, null given, called in ~/.config/composer/vendor/ecoapm/libyear/src/RepositoryAPI.php on line 31 and defined in ~/.config/composer/vendor/ecoapm/libyear/src/Repository.php:10
Stack trace:
#0 ~/.config/composer/vendor/ecoapm/libyear/src/RepositoryAPI.php(31): LibYear\Repository->__construct()
#1 ~/.config/composer/vendor/ecoapm/libyear/src/Calculator.php(27): LibYear\RepositoryAPI->getInfo()
#2 [internal function]: LibYear\Calculator->LibYear\{closure}()
#3 ~/.config/composer/vendor/ecoapm/libyear/src/Calculator.php(27): array_map()
#4 ~/.config/composer/vendor/ecoapm/libyear/src/App.php(70): LibYear\Calculator->getDependencyInfo()
#5 ~/.config/composer/vendor/ecoapm/libyear/src/App.php(35): LibYear\App->getDependencies()
#6 ~/.config/composer/vendor/ecoapm/libyear/libyear(11): LibYear\App->run()
#7 ~/.config/composer/vendor/bin/libyear(120): include('...')
#8 {main}
  thrown in ~/.config/composer/vendor/ecoapm/libyear/src/Repository.php on line 10

The url that doesn't have the metadata url is https://asset-packagist.org/packages.json

Was working ok in libyear 2.0.3

SteveDesmond-ca commented 1 year ago

Hi @marty-macfly, thanks for this bug report.

Indeed, the app was no longer silently handling when a repository did not provide metadata. This has been fixed in the just-released v2.2.0!

Proper handling of "provider-only" repositories (see #48) is forthcoming in a future version.