Permalink
Browse files

Prevent notice error in Twitter library.

The standard library doesn't check to ensure that the necessary tokens
actually exist, which may produce notices.
  • Loading branch information...
1 parent 9c156f7 commit 3508fd6d393ac7b75e303fdc9a918b18739d278a Michael Sisk committed Sep 26, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 -/library/twitter.php
View
@@ -89,6 +89,7 @@ function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oaut
* Get a request_token from Twitter
*
* @returns a key/value array containing oauth_token and oauth_token_secret
+ * @modified Michael Sisk
*/
function getRequestToken($oauth_callback = NULL) {
$parameters = array();
@@ -97,7 +98,9 @@ function getRequestToken($oauth_callback = NULL) {
}
$request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
$token = OAuthUtil::parse_parameters($request);
- $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
+ if ( isset( $token[ 'oauth_token' ], $token[ 'oauth_token_secret' ] ) ) {
+ $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
+ }
return $token;
}

0 comments on commit 3508fd6

Please sign in to comment.