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.
This commit is contained in:
Adam Williamson 2014-02-05 11:43:04 -08:00
parent 61d70b17ee
commit 5935758b3a
4 changed files with 38 additions and 11 deletions

View file

@ -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

View file

@ -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'

View file

@ -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;

View file

@ -113,24 +113,43 @@ 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.
* @param array $array