googleworkspace / php-samples

PHP samples for Google Workspace APIs
Apache License 2.0
288 stars 348 forks source link

Problem with PHP 7.2 and Quickstarts #29

Closed tobilektri closed 5 years ago

tobilektri commented 5 years ago

Expected Behavior

Runs throught example without errors

Actual Behavior

Problems with required Guzzle Client...

PHP Warning: count(): Parameter must be an array or an object that implements Countable in C:\Users[...]\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67

Warning: count(): Parameter must be an array or an object that implements Countable in C:\Users[...]\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67

Steps to Reproduce the Problem

  1. Install PHP 7.2
  2. Start Quickstart ;)

Specifications

jubilus commented 5 years ago

I get the following on Ubuntu 18.04 x64 with PHP 7.2.10-0ubuntu0.18.04.1

PHP Fatal error:  Uncaught InvalidArgumentException: missing the required redirect URI in /var/www/html/vendor/google/auth/src/OAuth2.php:650
Stack trace:
#0 /var/www/html/vendor/google/apiclient/src/Google/Client.php(339): Google\Auth\OAuth2->buildFullAuthorizationUri(Array)
#1 /var/www/html/quickstart.php(38): Google_Client->createAuthUrl()
#2 /var/www/html/quickstart.php(63): getClient()
#3 {main}
  thrown in /var/www/html/vendor/google/auth/src/OAuth2.php on line 650
rahatUlAin commented 5 years ago

Got this error Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. `` Fatal error: Uncaught Error: Class 'Google_Client' not found in C:\xampp\phpMyAd min\quickstart.php:14 Stack trace:

0 C:\xampp\phpMyAdmin\quickstart.php(63): getClient()

1 {main}

thrown in C:\xampp\phpMyAdmin\quickstart.php on line 14

xprimate commented 5 years ago

@tobilektri Had exactly the same issue running php 7.2 I had to edit the CurlFactory.php file at C:\Users[...]\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67 I had to cast the Object($this->handles) to an array: I changed this: if (count($this->handles) >= $this->maxHandles) { curl_close($resource); to this: $arrayHandle = (array)$this->handles; if (count($arrayHandle) >= $this->maxHandles) { curl_close($resource); } else {

This clear the error after re-entering the verification code, but then I go another message from my command line which am not sure its an error or warning or something else:

_Files: SAMVIC (1V8W0SguM210_nCZt5ZqtLUXSWa9TwS4Q) upgrade_221.html (1pwXW1bMjbcsaDa6izVIziSMBsWbEsFLX) upgrade_222.html (1shJX1DPaMdYOg_e6F5_NWdG8sPYGPF1i) pdo_sqlsrv_forge.php (1c7fw7CqYjTMPsXT5f_QfP-sxVE8PK3iP) pdo_sqlsrv_driver.php (1BcbnnXWoPA0M6mjIVRAs34Cig4UNlDjG) pdo_sqlite_forge.php (1ABhavgNtd2qHESJ06kwCPxQhjf9wWhn9) pdo_sqlite_driver.php (1ytHpG4AQF_ZXrTKu2nZjHV73zJauxPoo) pdo_odbc_forge.php (1VrsFMXtxDtCn9VWHS1pCE4jTrJ6U4yWX) pdo_odbc_driver.php (1RS9lM5EcgvTlX9Ay69lxpMwSCdH_k4if) pdo_oci_forge.php (1wolDrzxAvQXqHOSfjZBTHcMtKKsutQ3)

Well, I guess I have to find out when I run some other code.. Cheers.

erickoledadevrel commented 5 years ago

This appears to be the same problem reported here:

https://github.com/googleapis/google-api-php-client/issues/1507

They claim the issue was fixed in version 2.2.2 of the google/apiclient dependency. Can you try updating to that version and let me know if it works? If so I can update the version dependency in the instructions.

xprimate commented 5 years ago

@erickoledadevrel Thanks for the share. It seems like I have to manually update the guzzle folder.

liw105 commented 5 years ago

code download php error Fatal error: Uncaught exception 'Google_Service_Exception' with message '{ "error": { "errors": [ { "domain": "global", "reason": "fileNotExportable", "message": "Export only supports Google Docs." } ], "code": 403, "message": "Export only supports Google Docs." } } ' in C:\AppServ\www\google\vendor\google\apiclient\src\Google\Http\REST.php:118 Stack trace:

0 C:\AppServ\www\google\vendor\google\apiclient\src\Google\Http\REST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\Psr7\Response), Object(GuzzleHttp\Psr7\Request), NULL)

1 [internal function]: Google_Http_REST::doExecute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), NULL)

2 C:\AppServ\www\google\vendor\google\apiclient\src\Google\Task\Runner.php(181): call_user_func_array(Array, Array)

3 C:\AppServ\www\google\vendor\google\apiclient\src\Google\Http\REST.php(58): Google_Task_Runner->run()

4 C:\AppServ\www\google\vendor\google\apiclient\src\Google\Client.php(779): Google_Http_REST::execute(Object(GuzzleHttp in C:\AppServ\www\google\vendor\google\apiclient\src\Google\Http\REST.php on line 118

liw105 commented 5 years ago

Is there a solution? Please help.

ในวันที่ พฤ. 28 มี.ค. 2019 เวลา 23:43 Eric Koleda notifications@github.com เขียนว่า:

Closed #29 https://github.com/gsuitedevs/php-samples/issues/29.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gsuitedevs/php-samples/issues/29#event-2236914983, or mute the thread https://github.com/notifications/unsubscribe-auth/AuX27M-y6LmHyT1e-nT_ntl3rV__dvoXks5vbPEZgaJpZM4X95_K .

erickoledadevrel commented 5 years ago

Your problem isn't related to this issue. As the error message says, the file you are trying to export can't be exported.