|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53752 Make __construct non final
Submitted: 2011-01-14 18:35 UTC Modified: 2011-01-14 20:50 UTC
From: sylvain dot lecoy at gmail dot com Assigned:
Status: Not a bug Package: *Extensibility Functions
PHP Version: Irrelevant OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
34 - 2 = ?
Subscribe to this entry?

 [2011-01-14 18:35 UTC] sylvain dot lecoy at gmail dot com
In order to extends the OAuth object, make the constructor non final so we can 
redefine __constrcut().

This is useful for framework like drupal, and you can then create an OAuthAdapter 
(which extends OAuth pecl) and instantiate it by giving a module name.

e.g. new OAuthAdapter("facebook"); consumer_key and secret are stored by drupal 
convention so we can skip this step for développment and make the lib very dev-
friendly. (the pattern adapter allows redefinition in case the user don't have 
control on his webserver - shared environment for instance).

Sylvain Lecoy


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-14 18:39 UTC] sylvain dot lecoy at gmail dot com
class OAuthAdapter extends OAuth implements DrupalOAuthClient {
  private $mModule;

  static function construct($module, $signature_method = NULL, $auth_type = 
    $consumer_key = variable_get($module . '_consumer_key', '');
    $consumer_secret = variable_get($module . '_consumer_secret', '');
    $oauth = new OAuthAdapter($consumer_key, $consumer_secret, 
$signature_method, $auth_type);
    $oauth->mModule = $module;

    // If the user is not anonymous (can happen with cron auto-sync tasks).
    if ($GLOBALS['user']->uid != 0) {

    return $oauth;

Here is some code to illustrate a work around, but using __construct will be a 
lot better.

I am using 0.99.9 (on windows machine dev) maybe it has been changed on 1.0.0 ?
 [2011-01-14 20:50 UTC]
-Status: Open +Status: Bogus
 [2011-01-14 20:50 UTC]
Please report it at instead.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Oct 15 21:03:43 2021 UTC