2

https URL で curl コマンドを実行しようとすると、「解放されたオブジェクトのチェックサムが正しくありません」というエラーが発生し続けます。これは、私の osx 開発者マシンでのみ発生しています。ubuntu サーバーで同じコードを実行すると、発生しません。他のosxセットアップでも試してみましたが、すべてのマシンで同じエラーが発生しています。

http://php-osx.liip.ch/経由でインストールされたphp 5.4でMac OSX 10.7.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');
}

次の行でエラーがスローされます: '$response = curl_exec($ch);'、Web サービスが https の代わりに http で呼び出された場合、機能していました。

4

0 に答える 0