zhouaini528 / huobi-php

Huobi API Like the official document interface, Support for arbitrary extension.
MIT License
42 stars 23 forks source link

PHP 8.1 - Getting error method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given #15

Open leexin opened 1 year ago

leexin commented 1 year ago

method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given

0 /var/www/vendor/linwj/huobi/src/Request.php(167): method_exists()

1 /var/www/vendor/linwj/huobi/src/Api/Spot/Order.php(21): Lin\Huobi\Request->exec()

When submitting order to Huobi calling $client->order()->postPlace() Using PHP8.1

Probable fix to linwj/huobi/src/Request.php and linwj/binance/src/Request.php (might affect other exchanges Request.php too) if(method_exists($e->getResponse(),'getBody')){ to be changed to if( !empty($e->getResponse()) && method_exists($e->getResponse(),'getBody')){

zhouaini528 commented 1 year ago

Sorry I didn't find such a problem in PHP 8.1 2023-01-04 09-30-23屏幕截图

leexin commented 1 year ago

@zhouaini528 same issue as mentioned in OKEX here https://github.com/zhouaini528/okex-php/issues/5

zhouaini528 commented 1 year ago

@zhouaini528 same issue as mentioned in OKEX here zhouaini528/okex-php#5

Thanks for the discovery, I have solved the problem.