From 5935758b3a5d8c50cbc6bf7f31ce9ef7b4ba39f1 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 5 Feb 2014 11:43:04 -0800 Subject: bump google lib to c6949531d2 (post 1.0.3-beta, including query separator fix) This is the upstream commit that merged my query separator fix. It's slightly after the 1.0.3-beta tag. I eyeballed the other post 1.0.3-beta changes and none of them looks like any kind of problem, so we may as well just use this upstream state. --- .../google-api-php-client/src/Google/Client.php | 2 +- .../google-api-php-client/src/Google/Http/REST.php | 8 ++++- .../src/Google/Http/Request.php | 4 ++- .../google-api-php-client/src/Google/Model.php | 35 +++++++++++++++++----- 4 files changed, 38 insertions(+), 11 deletions(-) (limited to 'apps/files_external') diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php index daf1cb151c2..e61daf7f16e 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php @@ -35,7 +35,7 @@ require_once 'Google/Service/Resource.php'; */ class Google_Client { - const LIBVER = "1.0.2-beta"; + const LIBVER = "1.0.3-beta"; const USER_AGENT_SUFFIX = "google-api-php-client/"; /** * @var Google_Auth_Abstract $auth diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php index 43d46b1a85e..5ea4b752808 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php @@ -71,7 +71,13 @@ class Google_Http_REST $err .= ": ($code) $body"; } - throw new Google_Service_Exception($err, $code, null, $decoded['error']['errors']); + $errors = null; + // Specific check for APIs which don't return error details, such as Blogger. + if (isset($decoded['error']) && isset($decoded['error']['errors'])) { + $errors = $decoded['error']['errors']; + } + + throw new Google_Service_Exception($err, $code, null, $errors); } // Only attempt to decode the response, if the response code wasn't (204) 'no content' diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php index f1e9a422279..8643694da89 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php @@ -424,7 +424,9 @@ class Google_Http_Request list($key, $value) = explode('=', $part, 2); $value = urldecode($value); if (isset($return[$key])) { - $return[$key] = array($return[$key]); + if (!is_array($return[$key])) { + $return[$key] = array($return[$key]); + } $return[$key][] = $value; } else { $return[$key] = $value; diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php index d5d25e3c128..2b6e67ad5a0 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php @@ -113,23 +113,42 @@ class Google_Model implements ArrayAccess $props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC); foreach ($props as $member) { $name = $member->getName(); - if ($this->$name instanceof Google_Model) { - $object->$name = $this->$name->toSimpleObject(); - } else if ($this->$name !== null) { - $object->$name = $this->$name; + $result = $this->getSimpleValue($this->$name); + if ($result != null) { + $object->$name = $result; } } // Process all other data. foreach ($this->data as $key => $val) { - if ($val instanceof Google_Model) { - $object->$key = $val->toSimpleObject(); - } else if ($val !== null) { - $object->$key = $val; + $result = $this->getSimpleValue($val); + if ($result != null) { + $object->$key = $result; } } return $object; } + + /** + * Handle different types of values, primarily + * other objects and map and array data types. + */ + private function getSimpleValue($value) + { + if ($value instanceof Google_Model) { + return $value->toSimpleObject(); + } else if (is_array($value)) { + $return = array(); + foreach ($value as $key => $a_value) { + $a_value = $this->getSimpleValue($a_value); + if ($a_value != null) { + $return[$key] = $a_value; + } + } + return $return; + } + return $value; + } /** * Returns true only if the array is associative. -- cgit v1.2.3