Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php ';已释放对象的校验和不正确';在osx上使用https的libcurl_Php_Curl_Https_Libcurl - Fatal编程技术网

Php ';已释放对象的校验和不正确';在osx上使用https的libcurl

Php ';已释放对象的校验和不正确';在osx上使用https的libcurl,php,curl,https,libcurl,Php,Curl,Https,Libcurl,当我尝试在https url上执行curl命令时,我不断收到“释放对象的校验和不正确”错误。这只发生在我的osx开发者机器上,当我在ubuntu服务器上执行相同的代码时,它不会发生。我也在其他osx设置上尝试过,在每台机器上都会出现同样的错误 我正在运行MacOSX 10.7.4,通过安装PHP5.4 这是我在控制台中遇到的错误的一部分: Parent Process: httpd [2228] PlugIn Path: /usr/local/php5/lib/libcurl.4

当我尝试在https url上执行curl命令时,我不断收到“释放对象的校验和不正确”错误。这只发生在我的osx开发者机器上,当我在ubuntu服务器上执行相同的代码时,它不会发生。我也在其他osx设置上尝试过,在每台机器上都会出现同样的错误

我正在运行MacOSX 10.7.4,通过安装PHP5.4

这是我在控制台中遇到的错误的一部分:

Parent Process:  httpd [2228]

PlugIn Path:       /usr/local/php5/lib/libcurl.4.dylib
PlugIn Identifier: libcurl.4.dylib
PlugIn Version:    7.0.0 (compatibility 7.0.0)

Date/Time:       2012-07-31 09:30:50.602 +0200
OS Version:      Mac OS X 10.7.4 (11E53)
Report Version:  9

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
*** error for object 0x7fd15c8274f8: incorrect checksum for freed object - 
    object was probably modified after being freed.
导致此错误的代码如下所示:

function __doRequest($request, $location, $action, $version, $one_way = null)
{
    stream_wrapper_unregister('https');
    stream_wrapper_unregister('http');
    stream_wrapper_register('https', '<namespace>\\streamWrapperHttpAuth');
    stream_wrapper_register('http', '<namespace>\\streamWrapperHttpAuth');

    $headers = array(
        'User-Agent: PHP-SOAP', 'Content-Type: text/xml;charset=UTF-8', 
        'SOAPAction: "' . $action . '"', 
        'Content-Length: ' . strlen($request), 'Expect: 100-continue', 
        'Connection: Keep-Alive'
    );

    $this->__last_request_headers = $headers;
    $ch                           = curl_init($location);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);

    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_FAILONERROR, FALSE);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);

    curl_setopt($ch, CURLOPT_USERPWD, $this->Username . ':' . $this->Password);
    curl_setopt($ch, CURLOPT_SSLVERSION, 3);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);

    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    //curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
    curl_setopt($ch, CURLOPT_CERTINFO, TRUE);

    $response = curl_exec($ch);

    if (($info = curl_getinfo($ch)) && $info['http_code'] == 200) {
        return $response;
    }
    else if ($info['http_code'] == 401) {
        throw new \Exception ('Access Denied', 401);
    }
    else if (curl_errno($ch) != 0) {
        throw new \Exception(curl_error($ch) . curl_errno($ch) . 
            $location, curl_errno($ch));
    }
    else {
        //throw new \Exception($response, $info['http_code']);
        return $response;
    }

    stream_wrapper_restore('https');
    stream_wrapper_restore('http');
}
function\u doRequest($request、$location、$action、$version、$one\u way=null)
{
流_包装器_注销('https');
流_包装器_注销('http');
流包装器寄存器('https','\\streamWrapperHttpAuth');
流包装器寄存器('http','\\streamWrapperHttpAuth');
$headers=数组(
“用户代理:PHP-SOAP”,“内容类型:text/xml;charset=UTF-8”,
“SOAPAction:”.$action.“,
'内容长度:'.strlen($request),'预期:100继续',
“连接:保持活动”
);
$this->\uuu last\u request\u headers=$headers;
$ch=curl_init($location);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POST,TRUE);
curl_setopt($ch,CURLOPT_POSTFIELDS,$request);
curl_setopt($ch,CURLOPT_HTTP_VERSION,curl_HTTP_VERSION_1_1);
curl_setopt($ch,CURLOPT_FAILONERROR,FALSE);
curl_setopt($ch,CURLOPT_HTTPAUTH,CURLAUTH_NTLM);
curl_setopt($ch,CURLOPT_USERPWD,$this->Username.:'。$this->Password);
卷曲设置($ch,卷曲设置,3);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
//curl_setopt($ch,CURLOPT_VERBOSE,TRUE);
curl_setopt($ch,CURLOPT_CERTINFO,TRUE);
$response=curl\u exec($ch);
如果($info=curl\u getinfo($ch))&&$info['http\u code']==200){
返回$response;
}
else if($info['http_code']==401){
抛出新\异常('访问被拒绝',401);
}
如果(curl_errno($ch)!=0,则为else{
抛出新的\异常(curl\u error($ch)。curl\u errno($ch)。
$location,curl_errno($ch));
}
否则{
//抛出新的\异常($response,$info['http_code']);
返回$response;
}
流_包装_还原('https');
流_包装_还原('http');
}

错误在以下行抛出:“$response=curl_exec($ch);”,当通过http而不是https调用Web服务时,它起了作用。

听起来像是某个地方的bug……我遇到了同样的问题,同样的环境,但还没有找到解决方案。。。也许你同时发现了一些东西,比如某个地方的bug……我遇到了同样的问题,同样的环境,还没有找到解决方案。。。也许你同时发现了什么