hd-wallet-derive
hd-wallet-derive copied to clipboard
Uncaught Exception. code: 2, message: Undefined property: App\Utils\MyLogger::$_last_time
Would love to check out this script. This is what I got when trying the example;
20210315T020944Z: crystamped@mab:~/github/hd-wallet-derive$ ./hd-wallet-derive.php -g --key=xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6GoNMKUga5biW6Hx4tws2six3b9c
Uncaught Exception. code: 2, message: Undefined property: App\Utils\MyLogger::$_last_time
/home/crystamped/github/hd-wallet-derive/src/Utils/MyLogger.php : 183
Stack Trace:
#0 /home/crystamped/github/hd-wallet-derive/src/Utils/MyLogger.php(183): strictmode\_global_error_handler()
#1 /home/crystamped/github/hd-wallet-derive/src/Utils/MyLogger.php(201): App\Utils\MyLogger->format_log_msg()
#2 /home/crystamped/github/hd-wallet-derive/src/Utils/MyLogger.php(170): App\Utils\MyLogger->log()
#3 /home/crystamped/github/hd-wallet-derive/hd-wallet-derive.php(74): App\Utils\MyLogger->log_exception()
#4 /home/crystamped/github/hd-wallet-derive/hd-wallet-derive.php(83): main()
#5 {main}
WARNING: strictmode\ALERTS_MAILTO not defined in config. To disable this warning, define 'strictmode\ALERTS_DISABLE'. alert not sent with subject: [mab] [hd-wallet-derive.php] Uncaught exception! [pid: 308250]
Now exiting. Please report this problem to the software author
20210315T020945Z: crystamped@mab:~/github/hd-wallet-derive$
Ideas?
It's probably worth noting that I upgraded from PHP7 to PHP8 recently.
20210315T093946Z: crystamped@mab:~$ php -v
PHP 8.0.3 (cli) (built: Mar 5 2021 07:54:13) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.3, Copyright (c) Zend Technologies
with Zend OPcache v8.0.3, Copyright (c), by Zend Technologies
20210315T093950Z: crystamped@mab:~$
This is on Ubuntu 20.04;
20210315T094256Z: crystamped@mab:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
20210315T094257Z: crystamped@mab:~$
I'm seeing the same error even with php v7
PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Ok, so managed to fix this @GlenCooper
Line #104 in WalletDerive.php has a curly bracket that is deprecated in php 7.4 and above; changed it to:
$path_base = is_numeric( $params['path'][0] ) ? 'm/' . $params['path'] : $params['path'];
and the cli works ok now.
Found the problem to be a lot of '@$' scattered all across the source. While I hadn't closely vetted every 'fix' I did, most can be replaced by a (sort of) $var = @$var into $var = (isset($var) ? $var : null); PHP 8 will trip up on a lot of that code.
Finally got it running at least on PHP8.
I've forked it as a test and it works. Feel free to clone that down as test. Not sure how to contribute this back to this side :)
Ok, então consegui consertar este @GlenCooper A linha #104 da WalletDerive.php possui um suporte encaracolado que é preterido em php 7.4 ou superior; mudou para: $path_base = is_numeric( $params['path'][0] ? 'm/' . $params['caminho'] : $params['caminho']; e o cli funciona bem agora.
PRA MIM JA ESTAVA ASSIM E COMNTINUA COM O ERRO... =/
Addressed by #55. PHP8+ is now supported.