【问题标题】:PHP seg fault using PEAR OAuth provider class使用 PEAR OAuth 提供程序类的 PHP 段错误
【发布时间】:2011-06-05 03:48:47
【问题描述】:

我正在尝试使用 PHP 创建一个 oauth 提供程序,它是官方的 oauth 类。

我只是想让提供者处理请求,但实际上它给了我两个段错误。

这是我的提供者

<?php

    class Provider{

        private $oauth;

        public function __construct(){

            try {

            /* create our instance */
            $this->oauth = new OAuthProvider();

            /* setup check functions */
            $this->oauth->consumerHandler(array($this,'checkConsumer'));
            $this->oauth->timestampNonceHandler(array($this,'checkNonce'));
            $this->oauth->tokenHandler(array($this,'checkToken'));

            /* If we are issuing a request token we need to disable checkToken */
            if(strstr($_SERVER['REQUEST_URI'],"oauth/request_token")){
                $this->oauth->isRequestTokenEndpoint(true); 
            }

            /* now that everything is setup we run the checks */
                $this->oauth->checkOAuthRequest(null,OAUTH_HTTP_METHOD_GET);
            } catch(OAuthException $E){
                echo OAuthProvider::reportProblem($E);
                $this->oauth_error = true;
            }


        }

        public function checkConsumer($provider){
            $provider->consumer_secret = "secret";
            return OAUTH_OK;
        }

        public function checkToken($provider){
            return OAUTH_OK;
        }

        public function checkNonce($provider){
            return OAUTH_OK;
        }

    }
?>

这是我用于测试的客户端。

<?php
    $oauth_client = new Oauth("key","secret");
    try {
        $oauth_client->getRequestToken("http://localhost/OAuthProviderExample/oauth/request_token");
    } catch(OAuthException $E){
        echo $E;
    }
?>

客户端输出这个

exception 'OAuthException' with message 'making the request failed (dunno why)' in /var/www/OAuthProviderExample/client/index.php:4 Stack trace: #0 /var/www/OAuthProviderExample/client/index.php(4): OAuth->getRequestToken('http://localhos...') #1 {main}

错误日志显示了这一点

[Fri Jan 07 09:33:45 2011] [notice] child pid 3662 exit signal Segmentation fault (11)
[Fri Jan 07 09:33:45 2011] [notice] child pid 3663 exit signal Segmentation fault (11)

我现在不知道该怎么办!

【问题讨论】:

  • 你在哪个版本的 PHP 上运行这个?
  • PHP 5.3.3-1ubuntu9.1 和 Suhosin-Patch (cli)(构建时间:2010 年 10 月 15 日 14:17:04)

标签: php oauth oauth-provider


【解决方案1】:

显然PECL的1.0.0版本有bug。

从主干编译为我修复了它

【讨论】:

    猜你喜欢
    • 2011-08-30
    • 1970-01-01
    • 2011-03-28
    • 2012-01-27
    • 2012-01-09
    • 2015-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多