swoft-cloud / swoft

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

调用rpc 资源时,如果返回为空 解包未作判断 默认直接json_decode 报语法错误,是否可以增加判空判断 #328

Closed kyleliwotian closed 6 years ago

kyleliwotian commented 6 years ago
Q A
Bug report? no
Feature request? no
Swoft version 1.0.3
Swoole version 4.0.0 (by php --ri swoole)
PHP version 7.1.18 (by php -v)
Runtime environment Docker

Details

Describe what you are trying to achieve and what goes wrong.

// paste output here

//swoft\rpc\src\Packer\Json\JsonPacker->unpack() 方法

是否可以加判空操作?

Provide minimal script to reproduce the issue

// paste code
huangzhhui commented 6 years ago

判断是否为空也是一样要抛出异常的,从使用上还是要捕获异常