According to the Bird Brother blog Yar introduction, writing examples, reported yar_client_protocol_exception error, Google and Baidu have not found a solution, do you know the heroes?
yarserver.php
class API { public function hello ($param = '') { return $param; } protected function hello2 () { }}$service = new Yar_Server(new API());$service->handle();
yarclient.php
SetOpt(YAR_OPT_CONNECT_TIMEOUT, 1000);//Set packager to JSON$client->SetOpt(YAR_OPT_PACKAGER, "json");$result = $client->hello('zhangsan');
Error details
Warning: [Debug Yar_Client 15:48:0.982003]: 2204859703: call api 'hello' at (r)'http://yar.demo.com/yarServer.php' with '1' parameters in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10Warning: [Debug Yar_Client 15:48:0.982082]: 2204859703: pack request by 'JSON', result len '53', content: '{"i":2204859703,"m":"hello","p":' in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10Fatal error: Uncaught exception 'Yar_Client_Protocol_Exception' with message 'malformed response header 'Warning: [Debug Yar_Server 15:4'' in /home/liuruntao/YarRPC-Demo/public/yarClient.php:10Stack trace:#0 /home/liuruntao/YarRPC-Demo/public/yarClient.php(10): Yar_Client->__call('hello', Array)#1 /home/liuruntao/YarRPC-Demo/public/yarClient.php(10): Yar_Client->hello('zhangsan')#2 {main} thrown in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10
Reply content:
According to the Bird Brother blog Yar introduction, writing examples, reported yar_client_protocol_exception error, Google and Baidu have not found a solution, do you know the heroes?
yarserver.php
class API { public function hello ($param = '') { return $param; } protected function hello2 () { }}$service = new Yar_Server(new API());$service->handle();
yarclient.php
SetOpt(YAR_OPT_CONNECT_TIMEOUT, 1000);//Set packager to JSON$client->SetOpt(YAR_OPT_PACKAGER, "json");$result = $client->hello('zhangsan');
Error details
Warning: [Debug Yar_Client 15:48:0.982003]: 2204859703: call api 'hello' at (r)'http://yar.demo.com/yarServer.php' with '1' parameters in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10Warning: [Debug Yar_Client 15:48:0.982082]: 2204859703: pack request by 'JSON', result len '53', content: '{"i":2204859703,"m":"hello","p":' in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10Fatal error: Uncaught exception 'Yar_Client_Protocol_Exception' with message 'malformed response header 'Warning: [Debug Yar_Server 15:4'' in /home/liuruntao/YarRPC-Demo/public/yarClient.php:10Stack trace:#0 /home/liuruntao/YarRPC-Demo/public/yarClient.php(10): Yar_Client->__call('hello', Array)#1 /home/liuruntao/YarRPC-Demo/public/yarClient.php(10): Yar_Client->hello('zhangsan')#2 {main} thrown in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10
The cause of the error has been found, as long as the Yar debug function can be turned off!
vim php.iniyar.debug=0 ;或者注释掉
This is can solve the above problem, landlord whether know why will report this warning, why?