Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed issue if you want to do more than one request with the same request type #3

Merged
merged 1 commit into from

2 participants

@davidbehler

include leads to an error like this:

Fatal error: Cannot redeclare class OAuth_Request_Resource in /var/www/../OAuth_Request_Resource.php on line 18

After doing the get_user_info request via the flickr provider, I needed to make another request to get a list of photosets and for that purpose I added another method to the flickr provider which does another request with type 'resource' and that's when I got the above error because the OAuth_Request forge tries to inlcude the OAuth_Request_Resource.php again and that leads to the redeclaration of the class.

There might be other cases(classes where this is an issue. I could update all classes to use include_once instead of include, don't think it would break anything.

David Behler Fixed issue if you want to do more than one request with the same req…
…uest type. include leads to an error like this:

Fatal error: Cannot redeclare class OAuth_Request_Resource in /var/www/../OAuth_Request_Resource.php on line 18

After doing the get_user_info request via the flickr provider, I needed to make another request to get a list of photosets and for that purpose I added another method to the flickr provider which does another request with type 'resource' and that's when I got the above error because the OAuth_Request forge tries to inlcude the OAuth_Request_Resource.php again and that leads to the redeclaration of the class.

There might be other cases(classes where this is an issue. I could update all classes to use include_once instead of include, don't think it would break anything.
12f77ae
@philsturgeon philsturgeon merged commit 5da33e9 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2012
  1. Fixed issue if you want to do more than one request with the same req…

    David Behler authored
    …uest type. include leads to an error like this:
    
    Fatal error: Cannot redeclare class OAuth_Request_Resource in /var/www/../OAuth_Request_Resource.php on line 18
    
    After doing the get_user_info request via the flickr provider, I needed to make another request to get a list of photosets and for that purpose I added another method to the flickr provider which does another request with type 'resource' and that's when I got the above error because the OAuth_Request forge tries to inlcude the OAuth_Request_Resource.php again and that leads to the redeclaration of the class.
    
    There might be other cases(classes where this is an issue. I could update all classes to use include_once instead of include, don't think it would break anything.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 libraries/OAuth_Request.php
View
6 libraries/OAuth_Request.php
@@ -17,8 +17,8 @@ public static function forge($type, $method, $url = NULL, array $params = NULL)
{
$class = 'OAuth_Request_'.ucfirst($type);
- include $class.'.php';
-
+ include_once $class.'.php';
+
return new $class($method, $url, $params);
}
@@ -480,7 +480,7 @@ public function execute(array $options = NULL)
// Store the new headers
$options[CURLOPT_HTTPHEADER] = $headers;
- }
+ }
if ($this->method === 'POST')
{
Something went wrong with that request. Please try again.