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

Array to string conversion error on Laravel 5.6 #55

Open
malfianrasyidin opened this issue Nov 2, 2018 · 7 comments
Open

Array to string conversion error on Laravel 5.6 #55

malfianrasyidin opened this issue Nov 2, 2018 · 7 comments

Comments

@malfianrasyidin
Copy link

Array to string conversion {"exception":"[object] (ErrorException(code: 0): Array to string conversion at /PROJECT-ROOT/vendor/botman/driver-telegram/src/TelegramDriver.php:138)

Don't know much what's wrong with this error, do you have any ideas to solve this error out?
Thank you so much!

@christophrumpel
Copy link
Collaborator

Can you show us what code you wrote, just showing the error doesn't help enough.

@malfianrasyidin
Copy link
Author

Actually, I don't know exactly what went wrong. It happened when I add this package https://packagist.org/packages/yajra/laravel-datatables-oracle to my project. Seems really odd. Which code should I provide? Thanks!

@christophrumpel
Copy link
Collaborator

Hmm what happens when you remove this package? Is it then working again? If not, then for us, it would be good to know what you did when you get this error. Did you write something to the bot? What is the code that you wrote or have you tested the BotMan Studio examples?

@AlekseiiShevchuk
Copy link

AlekseiiShevchuk commented Dec 10, 2018

the problem is in concept of loading bot logic from route file because botman-resolving will be triggered for each application request even if it is absolutely unnecessary
I moved botman logic from route file to Controller handle method BotManController@handle. It solve problem globally, not only for yajra/laravel-datatables-oracle

Do not forget to add your webhook path to $except array in VerifyCsrfToken Middleware

@yog369
Copy link

yog369 commented Nov 8, 2020

I having the same problem with the implementation of datatable with Botman

@zamronypj
Copy link

zamronypj commented May 4, 2022

I got same issue with Botman v.2.6.1, telegram driver v1.6.2 and Laravel 5.8. Not sure why and I do not know how to reproduce it, but sometimes, $value in closure is an array. that is why line 154.

return $key.'='.$value;

throws exception. Still investigating. I will update when I get more information. I do not use datatable by the way as other mentioned, so I do not think this is related to datatable.

[2022-05-04 04:23:50] production.ERROR: Array to string conversion {"exception":"[object] (ErrorException(code: 0): Array to string conversion at /home/sinbot/vendor/botman/driver-telegram/src/TelegramDriver.php:154)
[stacktrace]
#0 /home/sinbot/vendor/botman/driver-telegram/src/TelegramDriver.php(154): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 [internal function]: BotMan\\Drivers\\Telegram\\TelegramDriver->BotMan\\Drivers\\Telegram\\{closure}()
#2 /home/sinbot/vendor/laravel/framework/src/Illuminate/Support/Collection.php(1120): array_map()
#3 /home/sinbot/vendor/botman/driver-telegram/src/TelegramDriver.php(155): Illuminate\\Support\\Collection->map()
#4 /home/sinbot/vendor/botman/driver-telegram/src/TelegramDriver.php(123): BotMan\\Drivers\\Telegram\\TelegramDriver->isValidLoginRequest()
#5 /home/sinbot/vendor/botman/botman/src/Drivers/DriverManager.php(174): BotMan\\Drivers\\Telegram\\TelegramDriver->hasMatchingEvent()
#6 /home/sinbot/vendor/botman/botman/src/BotManFactory.php(68): BotMan\\BotMan\\Drivers\\DriverManager->getMatchingDriver()
#7 /home/sinbot/vendor/botman/botman/src/BotManServiceProvider.php(22): BotMan\\BotMan\\BotManFactory::create()
#8 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/Container.php(785): BotMan\\BotMan\\BotManServiceProvider->BotMan\\BotMan\\{closure}()
#9 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/Container.php(667): Illuminate\\Container\\Container->build()
#10 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/Container.php(615): Illuminate\\Container\\Container->resolve()
#11 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(767): Illuminate\\Container\\Container->make()
#12 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(121): Illuminate\\Foundation\\Application->make()
#13 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(733): app()
#14 /home/sinbot/routes/botman.php(5): resolve()
#15 /home/sinbot/app/Providers/RouteServiceProvider.php(40): require('/home/sinbot/ap...')
#16 /home/sinbot/app/Providers/RouteServiceProvider.php(30): App\\Providers\\RouteServiceProvider->mapBotManCommands()
#17 [internal function]: App\\Providers\\RouteServiceProvider->map()
#18 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array()
#19 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#20 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod()
#21 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\\Container\\BoundMethod::call()
#22 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php(87): Illuminate\\Container\\Container->call()
#23 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php(36): Illuminate\\Foundation\\Support\\Providers\\RouteServiceProvider->loadRoutes()
#24 [internal function]: Illuminate\\Foundation\\Support\\Providers\\RouteServiceProvider->boot()
#25 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array()
#26 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#27 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod()
#28 /home/sinbot/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\\Container\\BoundMethod::call()
#29 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(827): Illuminate\\Container\\Container->call()
#30 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(810): Illuminate\\Foundation\\Application->bootProvider()
#31 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}()
#32 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(811): array_walk()
#33 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#34 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(210): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap()
#35 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\\Foundation\\Application->bootstrapWith()
#36 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(146): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#37 /home/sinbot/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#38 /home/sinbot/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle()
#39 {main}
"}

@chimit
Copy link
Contributor

chimit commented Jul 5, 2023

The problem is still there and is thrown randomly on the line 154. I can see it in logs.

return $key.'='.$value;

I can reliably reproduce it when I'm trying to delete an object from the DB via Laravel Nova (v2). I have no idea why Telegram driver is even called in that case. Looks like isValidLoginRequest() is called by mistake.

From Nova request I can see that $this->queryParameters is equal to {"search":"","filters":"W10=","trashed":"","resources":["6157"]} and as you can see the last parameter is an array.

I believe @AlekseiiShevchuk is right and the Telegram Driver is called all the time even when it's not needed because it runs from routes. @AlekseiiShevchuk could you, please, share some code?

Looks like getting rid of routes/botman.php makes tests impossible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants