swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 788 forks source link

consul注册服务失败提示连接成功 #324

Closed vim-z closed 6 years ago

vim-z commented 6 years ago
Q A
Bug report? yes
Feature request? yes/no
Swoft version 1.0.0-1.0.6
Swoole version 4.0.2 (by php --ri swoole)
PHP version 7.1.19 (by php -v)
Runtime environment /CentOS 7/Ubuntu/Docker etc.

Details

Provide minimal script to reproduce the issue

// Warning: Invalid argument supplied for foreach() in /home/wwwroot/swoft/vendor/swoft/http-client/src/HttpCoResult.php on line 51
object(Swoft\Http\Message\Base\Response)#1776 (8) {
  ["reasonPhrase":protected]=>
  string(21) "Internal Server Error"
  ["statusCode":protected]=>
  int(500)
  ["charset":protected]=>
  string(5) "utf-8"
  ["attributes":"Swoft\Http\Message\Base\Response":private]=>
  array(0) {
  }
  ["headerNames":protected]=>
  NULL
  ["headers":protected]=>
  array(0) {
  }
  ["protocol":protected]=>
  string(3) "1.1"
  ["stream":protected]=>
  object(Swoft\Http\Message\Stream\SwooleStream)#1781 (2) {
    ["contents":protected]=>
    string(0) ""
    ["size":protected]=>
    int(0)
  }
}
RPC service register success by consul ! tcp=172.17.0.2:8099
limingxinleo commented 6 years ago

这个问题我遇到过。。。

huangzhhui commented 6 years ago

这是因为没有判断status就输出文案了

vim-z commented 6 years ago

所以会在下个版本修改吗? @huangzhhui

limingxinleo commented 6 years ago

https://github.com/swoft-cloud/swoft-component/pull/187