hd-wallet-derive icon indicating copy to clipboard operation
hd-wallet-derive copied to clipboard

Uncaught Exception. code: 2, message: Undefined property: App\Utils\MyLogger::$_last_time

Open GlenCooper opened this issue 3 years ago • 6 comments

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?

GlenCooper avatar Mar 15 '21 02:03 GlenCooper

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:~$

GlenCooper avatar Mar 15 '21 09:03 GlenCooper

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:~$

GlenCooper avatar Mar 15 '21 09:03 GlenCooper

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

kalibox avatar Mar 28 '21 15:03 kalibox

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.

kalibox avatar Mar 28 '21 16:03 kalibox

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 :)

satyr-software avatar May 04 '21 06:05 satyr-software

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... =/

israel-nogueira avatar Jun 11 '22 02:06 israel-nogueira

Addressed by #55. PHP8+ is now supported.

dan-da avatar Nov 05 '23 23:11 dan-da