Issues

ZF2-35: Zend\OAuth\Signature and Zend\OAuth\AbstractSignature throw fatal error

Issue Type: Bug Created: 2011-07-17T01:04:38.000+0000 Last Updated: 2011-08-21T11:22:16.000+0000 Status: Resolved Fix version(s): Reporter: Clay Loveless (clay) Assignee: Pádraic Brady (padraic) Tags: - Zend\Oauth

  • zf-crteam-padraic
  • zf-crteam-priority

Related issues: Attachments:

Description

Attempting to create an OAuth request with Zend\OAuth throws a fatal error. I'm not a git master, so can't tell you exactly the revision I'm working with, but I did a 'git pull' immediately prior to filing this ticket, and the problem was happening there. 'git show' shows: d010912 fixed s/__construct/initialize/ for Initializable

<pre class="highlight">
function zflite_autoload($class)
{
    echo "zflite_autoload: $class\n";
    $class = str_replace(array('_','\\'), '/', $class);
    if (file_exists(__DIR__.'/../src/'.$class.'.php')) {
        include __DIR__.'/../src/'.$class.'.php';
    }
}
spl_autoload_register('zflite_autoload');

$termie = '<a href="http://term.ie/oauth/example">http://term.ie/oauth/example</a>';
$config = array(
  'consumerKey' => 'key',
  'consumerSecret' => 'secret',
  'siteUrl' => $termie,
  'requestTokenUrl' => "$termie/request_token.php",
  'accessTokenUrl' => "$termie/access_token.php"
);

$consumer = new Zend\OAuth\Consumer($config);

// fetch request token
$token = $consumer->getRequestToken();
var_dump($token);





<pre class="literal">
PHP Fatal error:  Can't inherit abstract function Zend\OAuth\Signature::sign() (previously declared abstract in Zend\OAuth\Signature\AbstractSignature) in /Users/clay/Desktop/zf2test/src/Zend/OAuth/Signature/AbstractSignature.php on line 39
PHP Stack trace:
PHP   1. {main}() /Users/clay/Desktop/zf2test/tests/scratch.inc:0
PHP   2. Zend\OAuth\Consumer->getRequestToken() /Users/clay/Desktop/zf2test/tests/scratch.inc:62
PHP   3. Zend\OAuth\Http\RequestToken->execute() /Users/clay/Desktop/zf2test/src/Zend/OAuth/Consumer.php:106
PHP   4. Zend\OAuth\Http\RequestToken->assembleParams() /Users/clay/Desktop/zf2test/src/Zend/OAuth/Http/RequestToken.php:55
PHP   5. Zend\OAuth\Http\Utility->sign() /Users/clay/Desktop/zf2test/src/Zend/OAuth/Http/RequestToken.php:94
PHP   6. zflite_autoload() /Users/clay/Desktop/zf2test/tests/scratch.inc:0
PHP   7. include() /Users/clay/Desktop/zf2test/tests/scratch.inc:45
PHP   8. zflite_autoload() /Users/clay/Desktop/zf2test/tests/scratch.inc:0
PHP   9. include() /Users/clay/Desktop/zf2test/tests/scratch.inc:45

Comments

Posted by Andris Causs (cypher) on 2011-07-31T17:29:10.000+0000

You can delete the function definition from /Zend/OAuth/Signature/AbstractSignature.php:

<pre class="highlight">@@ -82,16 +82,6 @@
     }
 
     /**
-     * Sign a request
-     * 
-     * @param  array $params 
-     * @param  null|string $method 
-     * @param  null|string $url 
-     * @return string
-     */
-    public abstract function sign(array $params, $method = null, $url = null);
-
-    /**
      * Normalize the base signature URL
      * 
      * @param  string $url 

Posted by Pádraic Brady (padraic) on 2011-08-21T11:22:16.000+0000

Assigned to wrong person.

Fixed all fatal errors (due to Zend\URI change and fudgy interface inheritance issues). Sent as pull request and fixed on local zend-oauth-cleanup branch on my fork.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts