shahinbdboy / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
0 stars 0 forks source link

Calendar API: "Invalid json in service response: {}" exception with partial calendar response #131

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When using the partial response feature via the "fields" optional parameter and 
the requested event range does not contain any events the google-api-php-client 
throws an invalid json exception.

What steps will reproduce the problem?
Below is an example (just search a time period with no events):

$service = new apiCalendarService($client);

$params['timeMin'] = date(DATE_RFC3339, $start);
$params['timeMax'] = date(DATE_RFC3339, $end);
$params['timeZone'] = 'America/New_York';
$params['orderBy'] = 'startTime';
$params['singleEvents'] = TRUE;
$params['fields'] = 'items(id,sequence,start,summary)';

$events = $service->events->listEvents('primary', $params);

What is the expected output? What do you see instead?
Expected:
An empty Events object

Actual Result (truncated stack trace):
PHP Fatal error:  Uncaught exception 'apiServiceException' with message 
'Invalid json in service response: {}\n' in 
google-api-php-client-0.5.0/src/io/apiREST.php:93\nStack trace:\n#0 
google-api-php-client-0.5.0/src/io/apiREST.php(56): 
apiREST::decodeHttpResponse(Object(apiHttpRequest))

What version of the product are you using? On what operating system?
v0.5.0 on RHEL 5.8 using system packaged PHP v5.3.3

Please provide any additional information below.
There is only a problem when no events are found. 

Original issue reported on code.google.com by herri...@denison.edu on 16 May 2012 at 5:57

GoogleCodeExporter commented 8 years ago

Original comment by chirags@google.com on 16 May 2012 at 6:07

GoogleCodeExporter commented 8 years ago
Fixed on trunk as of t435.
Thank you for reporting this issue!

Original comment by chirags@google.com on 16 May 2012 at 7:03