ZF-4158: GData Ignores my parameters (max-results, start-index etc) when fetching feeds


GData Ignores my parameters (max-results, start-index etc) when fetching feeds. No matter what parameter values I add, the GData cbntacts feed always returns the same data set (first 25 entries)

Here's my code:

<?php session_start(); //header("Content-type: text/xml");

require_once 'Zend/Oauth/Consumer.php'; require_once 'Zend/Crypt/Rsa/Key/Private.php'; require_once 'Zend/Gdata/ClientLogin.php'; require_once 'Zend/Gdata.php';

$users_index = $_SESSION['users_index'];

// my rsa key string. when in production, put this string in an external file and call it using get_file_contents $test_cert = <<<_CERT -----BEGIN RSA PRIVATE KEY----- sadfdsfsdfdsfsdfsdfsdsdfsdfsdfsdfsdfsd -----END RSA PRIVATE KEY----- _CERT;

$options = array( 'requestScheme' => Zend_Oauth::REQUEST_SCHEME_QUERYSTRING, 'version' => '1.0', 'signatureMethod' => 'RSA-SHA1', 'callbackUrl' => '', // UPDATE FOR YOUR DETAILS 'requestTokenUrl' => ' OAuthGetRequestToken', 'userAuthorisationUrl' => ' OAuthAuthorizeToken', 'accessTokenUrl' => ' OAuthGetAccessToken', 'consumerKey' => '', // UPDATE FOR YOUR DETAILS 'consumerSecret' => new Zend_Crypt_Rsa_Key_Private($test_cert) );

/** * Example utilises the Google Contacts API */

$consumer = new Zend_Oauth_Consumer($options);

if (!isset($_SESSION['ACCESS_TOKEN_GOOGLE'])) { if (!empty($_GET)) { // Google does not like empty POST bodies - switch to GET $token = $consumer->getAccessToken($_GET, unserialize($_SESSION['REQUEST_TOKEN_GOOGLE']), Zend_Oauth::GET); $_SESSION['ACCESS_TOKEN_GOOGLE'] = serialize($token); } else { // Default POST works fine here since POST body contains scope parameter $token = $consumer->getRequestToken(array('scope'=>'http://'), Zend_Oauth::GET); $_SESSION['REQUEST_TOKEN_GOOGLE'] = serialize($token); $consumer->redirect(); exit; } } else {

$token = unserialize($_SESSION['ACCESS_TOKEN_GOOGLE']);


// OAuth Access Token Retreived; Proceed to query Data API $client = $token->getHttpClient($options); //$client->setUri(' full'); //$client->setMethod(Zend_Http_Client::GET);

$contact = new Zend_Gdata($client);

$contact_count =0;

$query = new Zend_Gdata_Query(' default/full');

$feed = $contact->getFeed($query);

$name = ""; $email = "";

$db = new db_connect(); $db = $db->db;

foreach($feed as $entry){ $name = $entry->title;

    $parts = $entry->getExtensionElements();
    foreach($parts as $p){
            $element = $p->getDOM();
                    case 'email':
                            $email = $element->getAttribute('address');

$data = array( 'name' => "$name", 'email' => "$email", 'users_index' => $users_index );

//insert into DB here

$contact_count++; }


This is being caused by Zend_Oauth_client not preserving query parameters on a GET request.

Attached [^ZF-4158_v1.patch] as a patch to fix this behavior, to be sent to [~padraic] for review.

I am still seeing this issue with the latest version in the incubator:…

and the above patch unfortunately doesn't seem to fix it.

I'm experiencing the same issue - GET params are stripped before sending requests, meaning that using Zend_Oauth for GData doesn't work beyond authentication.

Is there any update on this?

sorry, my mistake.

the patch fixes the issue but you still need to manually set:


before sending your request.

looks good though.

Fixed in r20938