From 075fc52b1af4ddd2b8a42cd62aa651f90fbd059e Mon Sep 17 00:00:00 2001 From: Stig Manning Date: Sat, 13 Jun 2015 22:32:37 +1000 Subject: [PATCH] Fix for PHP autoloader failing to find key file in some instances (Thanks @lukyrys) --- gapi.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gapi.class.php b/gapi.class.php index 7ee4d8b..bcde336 100644 --- a/gapi.class.php +++ b/gapi.class.php @@ -609,7 +609,11 @@ public function fetchToken($client_email, $key_file, $delegate_email = null) { $data = $this->base64URLEncode(json_encode($header)) . '.' . $this->base64URLEncode(json_encode($claimset)); if (!file_exists($key_file)) { - throw new Exception('GAPI: Failed load key file "' . $key_file . '". File could not be found.'); + if ( !file_exists(__DIR__ . DIRECTORY_SEPARATOR . $key_file) ) { + throw new Exception('GAPI: Failed load key file "' . $key_file . '". File could not be found.'); + } else { + $key_file = __DIR__ . DIRECTORY_SEPARATOR . $key_file; + } } $key_data = file_get_contents($key_file);