geocoder-php/GeocoderLaravel

Argument 1 passed to Geocoder\Laravel\ProviderAndDumperAggregator::getArguments() must be of the type array, string given,

darkcast64 opened this issue · 11 comments

General Information

GeocoderLaravel Version: 4.1
Laravel Version: 5.8
PHP Version: 7.2
Operating System and Version: windows 10

Issue Description

i have this error when i try to go to my view.

i have installer toinOu/geocoder-laravel

set geocoder.php like this :

use Geocoder\Provider\BingMaps\BingMaps;
use Geocoder\Provider\Chain\Chain;

use Ivory\HttpAdapter\CurlHttpAdapter;

return [
    'cache' => [

       
        'store' => null,

        

        'duration' => 9999999,
    ],

   
    'providers' => [
        Chain::class => [
            BingMaps::class => [
                'en-US',
                env('mybingkey'),
        ],
    ],

   
    'adapter'  => CurlHttpAdapter::class,

   
    'reader' => null,

]
];

set up my controller like this :

namespace App\Http\Controllers;


use Geocoder\Provider\Chain\Chain;
use Illuminate\Http\Request;


class GeocoderController extends Controller
{
    public function index()
    {

        $geocode = app('geocoder')->geocode(['Los Angeles, CA'])->using('BingMaps')->get();
        return $geocode;
    }


}

@darkcast64 Please post the complete stack trace of the error.

Argument 1 passed to Geocoder\Laravel\ProviderAndDumperAggregator::getArguments() must be of the type array, string given, called in C:\wamp64\www\laravel\siteBertrandParrot\vendor\toin0u\geocoder-laravel\src\ProviderAndDumperAggregator.php on line 246

is it what do you want?

The complete stack trace from /storage/logs/laravel.log. It should be many lines, starting with a timestamp.

[2019-08-22 13:46:44] local.ERROR: Argument 1 passed to Geocoder\Laravel\ProviderAndDumperAggregator::getArguments() must be of the type array, string given, called in C:\wamp64\www\laravel\siteBertrandParrot\vendor\toin0u\geocoder-laravel\src\ProviderAndDumperAggregator.php on line 246 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 1 passed to Geocoder\\Laravel\\ProviderAndDumperAggregator::getArguments() must be of the type array, string given, called in C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\toin0u\\geocoder-laravel\\src\\ProviderAndDumperAggregator.php on line 246 at C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\toin0u\\geocoder-laravel\\src\\ProviderAndDumperAggregator.php:222)
[stacktrace]
#0 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\toin0u\\geocoder-laravel\\src\\ProviderAndDumperAggregator.php(246): Geocoder\\Laravel\\ProviderAndDumperAggregator->getArguments('Ivory\\\\HttpAdapt...', 'adapter')
#1 [internal function]: Geocoder\\Laravel\\ProviderAndDumperAggregator->Geocoder\\Laravel\\{closure}('Ivory\\\\HttpAdapt...', 'adapter')
#2 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Collection.php(1120): array_map(Object(Closure), Array, Array)
#3 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\toin0u\\geocoder-laravel\\src\\ProviderAndDumperAggregator.php(254): Illuminate\\Support\\Collection->map(Object(Closure))
#4 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\toin0u\\geocoder-laravel\\src\\ProviderAndDumperAggregator.php(152): Geocoder\\Laravel\\ProviderAndDumperAggregator->getProvidersFromConfiguration(Object(Illuminate\\Support\\Collection))
#5 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\toin0u\\geocoder-laravel\\src\\Providers\\GeocoderService.php(35): Geocoder\\Laravel\\ProviderAndDumperAggregator->registerProvidersFromConfig(Object(Illuminate\\Support\\Collection))
#6 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(785): Geocoder\\Laravel\\Providers\\GeocoderService->Geocoder\\Laravel\\Providers\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
#7 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(667): Illuminate\\Container\\Container->build(Object(Closure))
#8 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(265): Illuminate\\Container\\Container->resolve('Geocoder\\\\Larave...', Array, false)
#9 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(785): Illuminate\\Container\\Container->Illuminate\\Container\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
#10 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(667): Illuminate\\Container\\Container->build(Object(Closure))
#11 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(615): Illuminate\\Container\\Container->resolve('geocoder', Array)
#12 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(767): Illuminate\\Container\\Container->make('geocoder', Array)
#13 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\helpers.php(121): Illuminate\\Foundation\\Application->make('geocoder', Array)
#14 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\app\\Http\\Controllers\\GeocoderController.php(15): app('geocoder')
#15 [internal function]: App\\Http\\Controllers\\GeocoderController->index()
#16 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): call_user_func_array(Array, Array)
#17 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('index', Array)
#18 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(219): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\GeocoderController), 'index')
#19 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(176): Illuminate\\Routing\\Route->runController()
#20 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(680): Illuminate\\Routing\\Route->run()
#21 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#22 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(75): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#32 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(66): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#38 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#39 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#40 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#41 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(682): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#42 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(657): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#43 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(623): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#44 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(612): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#45 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#46 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#47 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\fideloper\\proxy\\src\\TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#48 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#51 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#54 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#57 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode.php(62): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#60 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#61 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#62 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#63 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#64 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#65 C:\\wamp64\\www\\laravel\\siteBertrandParrot\\public\\index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#66 {main}

To debug, first remove the type hint array from the first argument passed into Geocoder\Laravel\ProviderAndDumperAggregator::getArguments(), then dd() the argument to see what value is being passed in.

Thanks for the stack trace (in the future, don't forget to put it in code markers).

i did what you sayed, i have this :

array:1 [▼
  "Geocoder\Provider\BingMaps\BingMaps" => array:2 [▼
    0 => "en-US"
    1 => null
  ]
]

Try \Log::debug([....]); instead of dd(), looks like the first one is right, perhaps there are subsequent calls that trigger the error. You will find the output in the log file, just prior to the error.

[2019-08-22 14:12:04] local.DEBUG: array (
  0 => 
  array (
    'Geocoder\\Provider\\BingMaps\\BingMaps' => 
    array (
      0 => 'en-US',
      1 => NULL,
    ),
  ),
)  
[2019-08-22 14:12:04] local.DEBUG: array (
  0 => 
  array (
    0 => 'en-US',
    1 => NULL,
  ),
)  
[2019-08-22 14:12:04] local.DEBUG: array (
  0 => 'Ivory\\HttpAdapter\\CurlHttpAdapter',
)

That third entry is the problem. In fact, the last two are both incorrect. I will see what I can find out. Thanks for reporting this.

I am unable to replicate this at this time. Chances are this has been fixed in a previous release. Please let me know if you are still getting this after updating to the latest release.