File tree Expand file tree Collapse file tree 2 files changed +6
-30
lines changed Expand file tree Collapse file tree 2 files changed +6
-30
lines changed Original file line number Diff line number Diff line change @@ -929,25 +929,9 @@ public function setCache(CacheInterface $cache)
929929 */
930930 public function getCache ()
931931 {
932- if (!isset ($ this ->cache )) {
933- $ this ->cache = $ this ->createDefaultCache ();
934- }
935-
936932 return $ this ->cache ;
937933 }
938934
939- protected function createDefaultCache ()
940- {
941- if ($ this ->isAppEngine ()) {
942- $ cache = new Google_Cache_Memcache ();
943- } else {
944- $ cacheDir = sys_get_temp_dir () . '/google-api-php-client ' ;
945- $ cache = new Google_Cache_File ($ cacheDir );
946- }
947-
948- return $ cache ;
949- }
950-
951935 /**
952936 * Set the Logger object
953937 * @param Psr\Log\LoggerInterface $logger
@@ -1056,7 +1040,11 @@ private function createApplicationDefaultCredentials()
10561040
10571041 protected function getAuthHandler ()
10581042 {
1059- return Google_AuthHandler_AuthHandlerFactory::build ($ this ->getCache ());
1043+ // we intentionally do not use the cache because
1044+ // the underlying auth library's cache implementation
1045+ // is broken.
1046+ // @see https://github.com/google/google-api-php-client/issues/821
1047+ return Google_AuthHandler_AuthHandlerFactory::build ();
10601048 }
10611049
10621050 private function createUserRefreshCredentials ($ scope , $ refreshToken )
Original file line number Diff line number Diff line change @@ -254,6 +254,7 @@ public function testSettersGetters()
254254
255255 $ client ->setRedirectUri ('localhost ' );
256256 $ client ->setConfig ('application_name ' , 'me ' );
257+ $ client ->setCache (new Google_Cache_Null ());
257258 $ this ->assertEquals ('object ' , gettype ($ client ->getCache ()));
258259
259260 try {
@@ -268,19 +269,6 @@ public function testSettersGetters()
268269 $ this ->assertEquals ($ token , $ client ->getAccessToken ());
269270 }
270271
271- /**
272- * @requires extension Memcached
273- */
274- public function testAppEngineMemcacheConfig ()
275- {
276- $ _SERVER ['SERVER_SOFTWARE ' ] = 'Google App Engine ' ;
277- $ client = new Google_Client ();
278-
279- $ this ->assertInstanceOf ('Google_Cache_Memcache ' , $ client ->getCache ());
280-
281- unset($ _SERVER ['SERVER_SOFTWARE ' ]);
282- }
283-
284272 public function testAppEngineStreamHandlerConfig ()
285273 {
286274 $ this ->onlyGuzzle5 ();
You can’t perform that action at this time.
0 commit comments