question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, ccxt\huobi given in repos/huobi-bot/vendor/ccxt/ccxt/php/Exchange.php:1821

See original GitHub issue

Hello,

I’m trying to make ccxt works but I think I get a very basic error.

  • OS: Debian Bookworm
  • Programming Language version: PHP 8.1.5
  • CCXT version: “ccxt/ccxt”: “^1.16”
<?php
require_once __DIR__.'/vendor/autoload.php';

$exchange = new \ccxt\huobi(
    [
        'apiKey' => 'aaaaaaaaaaaaaa',
        'secret' => 'ssssssssssssss',
    ]
);
$exchange->load_markets();
print_r($exchange->fetch_markets());

print_r($
Array
(
    [0] => Array
        (
            [precision] => Array
                (
                )

            [limits] => Array
                (
                )

            [id] => btc
            [symbol] => BTC/CNY
            [base] => BTC
            [quote] => CNY
            [type] => staticmarket
            [coinType] => 1
        )

    [1] => Array
        (
            [precision] => Array
                (
                )

            [limits] => Array
                (
                )

            [id] => ltc
            [symbol] => LTC/CNY
            [base] => LTC
            [quote] => CNY
            [type] => staticmarket
            [coinType] => 2
        )

)
PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, ccxt\huobi given in /repos/huobi-bot/vendor/ccxt/ccxt/php/Exchange.php:1821
Stack trace:
#0 /repos/huobi-bot/vendor/ccxt/ccxt/php/Exchange.php(1821): array_key_exists()
#1 /repos/huobi-bot/vendor/ccxt/ccxt/php/huobi.php(91): ccxt\Exchange->__call()
#2 /repos/huobi-bot/bot.php(13): ccxt\huobi->fetch_balance()
#3 {main}
  thrown in /repos/huobi-bot/vendor/ccxt/ccxt/php/Exchange.php on line 1821

There are two problems there, beside the PHP Fatal, I also find weird that the load_markets() only returns 2 markets.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Layncommented, May 23, 2022

All good, for some reason when I did: composer require ccxt/ccxt It installed that old version. With the new version all is good. Thanks.

1reaction
Layncommented, May 23, 2022

Not sure why it installed this version, I’ll try to install the last one. And come back with the verbose output, may be that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: join(): Argument #2 ($array) must be of ...
The data for the chart comes from a mysql database. This is the error: Uncaught TypeError: join(): Argument #2 ($array) must be of...
Read more >
array_key_exists(): Argument #2 ($array) must be of ... - GitHub
This is type related issue because in PHP 8 array_key_exist is not working on non array times and here In ApiRequestor.php we are...
Read more >
Uncaught TypeError: array_key_exists(): Argument #2 ($array ...
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, EJ\DropDownList given in ...
Read more >
BUGFIX – Fatal error: Uncaught TypeError: array_key_exists ...
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, GF_Field_Post_Title given in ...
Read more >
array_key_exists - Manual - PHP
array_key_exists() returns true if the given key is set in the array. key can be any value possible for an array index. Parameters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found