geocoder-php / Geocoder

The most featured Geocoder library written in PHP.
https://geocoder-php.org
MIT License
3.94k stars 516 forks source link

Fix building ProviderNotRegistered exception message #1020

Closed norkunas closed 4 years ago

norkunas commented 4 years ago

Exception tries to implode the providers list, but providers doesn't have __toString implementations and so it fails.

PHP Warning:  Uncaught ErrorException: Catchable Fatal Error: Object of class Geocoder\Plugin\PluginProvider could not be converted to string in ~/www/sf/vendor/willdurand/geocoder/Exception/ProviderNotRegistered.php:29
Stack trace:
#0 ~/www/sf/vendor/willdurand/geocoder/ProviderAggregator.php(148): Geocoder\Exception\ProviderNotRegistered::create('address', Array)
#1 ~/www/sf/vendor/willdurand/geocoder-bundle/Command/GeocodeCommand.php(69): Geocoder\ProviderAggregator->using('address')
#2 ~/www/sf/vendor/symfony/console/Command/Command.php(255): Bazinga\GeocoderBundle\Command\GeocodeCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 ~/www/sf/vendor/symfony/console/Application.php(933): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 ~/www/sf in ~/www/sf/vendor/willdurand/geocoder/Exception/ProviderNotRegistered.php on line 29
norkunas commented 4 years ago

Ping :)

atymic commented 4 years ago

Looks good to me. Could you add a test case?

norkunas commented 4 years ago

Improved existing test.

atymic commented 4 years ago

Thanks for the PR 😄

Sorry for the delay.