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:


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';

$termie = '<a href=""></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();

<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/
PHP   2. Zend\OAuth\Consumer->getRequestToken() /Users/clay/Desktop/zf2test/tests/
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/
PHP   7. include() /Users/clay/Desktop/zf2test/tests/
PHP   8. zflite_autoload() /Users/clay/Desktop/zf2test/tests/
PHP   9. include() /Users/clay/Desktop/zf2test/tests/


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.


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

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