2011-06-27 17 views
0

私のコントローラでこのコードを使用してKohana 3.1で外部リクエストを実行しようとしています。私はこのエラーを取得していkohana 3.1外部リクエスト:POSTアプリケーション/ xmlがネイティブでは動作しません

$request = Request::factory($url); 
$request->method(Request::POST); 
$request->body($xml); 
$request->headers('Content-Type', 'application/xml'); 
$response = $request->execute(); 

:コード内のいくつかの研究の後

HTTP_Exception_500 [ 500 ]: Kohana_HTTP_Header_Value::__construct unknown header value type: integer. array or string allowed. 

、私はこれはクラスKohana_Request_Client_Externalの機能_native_executeに問題だったが分かりました。

ようなので、この機能セット「コンテンツ長」:

$body = $request->body(); 
$request->headers('content-length', strlen($body)); 

しかし$request->header(...)が文字列または2番目のパラメータのアレイとstrlenを期待する整数を返します。

バグですか?

ErrorException [ Warning ]: fopen(http://xxx.xxx.xxx.xxx/yyyyy) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: HTTP wrapper does not support writeable connections 

このエラーは_native_executeで再びコード$mode = ($request->method() === HTTP_Request::GET) ? 'r' : 'r+';のこの行から来ている:私はその後、私は別のエラーを得た。この$request->headers('content-length', (string)strlen($body));

のようにそれを修正しました。

私は$modeの値をrとしましたが、今は動作します。これらの2つのエラーはバグですか、何か間違っていますか?

答えて

2

これはバグで、3.1/developブランチで修正されました。それは次のポイントリリース(すぐに)でリリースされます。

+0

知っておきたいことです – jackdbernier

関連する問題