jrgp/linfo

PHP8 TypeError

ilianiv opened this issue · 6 comments

In PHP 8, internal function parameters have types and value validations enforced, and will throw \TypeError or \ValueError exceptions if the expected type or value is not allowed.

Error:
ceil(): Argument #1 ($num) must be of type int|float, string given

At:
.../vendor/linfo/linfo/src/Linfo/OS/Linux.php::getUptime()

 // Seconds
 list($seconds) = explode(' ', $contents, 1);

 // Get it textual, as in days/minutes/hours/etc
 $uptime = Common::secondsConvert(ceil($seconds));
                                  ^^^
jrgp commented

Thanks for the fix. I wonder if there are any other old bugs lurking..

Hi @jrgp,
Please release a new version with this fix.
linfo is still incompatible with PHP 8 due to this bug.

jrgp commented

Hey, just released v4.0.6

@jrgp maybe you've forgot to publish v4.0.6 in packagaist https://packagist.org/packages/linfo/linfo?
4.0.5 it the latest there.

jrgp commented

Ah yeah that isn't done automatically yet. Will look into it.

jrgp commented

v4.0.6 has been published & I just set up the web hook to auto publish future versions