ZF2-35: Zend\OAuth\Signature and Zend\OAuth\AbstractSignature throw fatal error
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
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 = 'http://term.ie/oauth/example';
$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);
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:
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.