Front-End & Daily

How to resolve the error "TypeError: implode(): Argument..." when working with Google Sheets API

How to resolve the error

A note on how to resolve a PHP error encountered while working with the Google Sheets API.

The error message was as follows:

Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /root/vendor/google/apiclient/src/Google/Service/Resource.php:291 (以下略)

Anyway, it seems there's an issue on line 291 of /vendor/google/apiclient/src/Google/Service/Resource.php, so let's take a look.

Line 291 was:

$requestUrl .= '?' . implode($queryVars, '&');

It worked after changing it like this:

$requestUrl .= '?' . implode('&', $queryVars);

implode() correctly takes the delimiter as its first argument.

Comments

After reviewing the content, personal information will be omitted before publication.

Enter your name and email address

Please enter if you would like a reply by email.

Personal information provided will not be disclosed. It will only be used for replies.

It will be sent directly. Please confirm and click "Send".

If this was helpful, we appreciate your support!
Your support will be used for childcare.

Send support via OFUSE


Or support by buying something from the buttons below
(You don't have to buy the linked product.)

Amazon

楽天市場

Yahoo!ショッピング

PR

As an Amazon Associate, "Ken" earns from qualifying purchases.

Share

Share on Twitter Share on Facebook Share on LINE Share on Hatena Bookmark