1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【PHP】Google SheetsAPI で Fatal error: Uncaught TypeError: count():

Last updated at Posted at 2022-03-08

API接続がローカル環境のPC上では動いていたのに、windows server 2012上ではエラー。

エラー内容

エラー内容
Fatal error:  Uncaught TypeError: count(): Argument #1($value) must be of type Countable| array, null given in C: \xampp\htdocs\example\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php: 67 Stack trace:

解決

以下ページでCurlFactory.php のcount()が正しくない状態との解説。
https://github.com/googleapis/google-api-php-client/issues/1392
/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php の
67行目のif文の書き出しを以下に変更することで解消。

CurlFactory.php
// ~67行目
if(count((array)$this-> handles)> = $this-> maxHandles){
// ~~

保存しようとするとvscodeが警告を出したが問題なく動く。
勉強になった。

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?