Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
leexin opened this issue Dec 17, 2022 · 3 comments

Comments

@leexin
Copy link

leexin commented Dec 17, 2022

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')){

@leexin leexin changed the title Getting error method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given PHP 8.1 - Getting error method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given Dec 17, 2022
@zhouaini528
Copy link
Owner

zhouaini528 commented Jan 4, 2023

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

@leexin
Copy link
Author

leexin commented Jan 4, 2023

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

@zhouaini528
Copy link
Owner

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

Thanks for the discovery, I have solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants