PHP 8.1 warnings

3 views
Skip to first unread message

Greg Childers

unread,
Jun 9, 2022, 4:38:33 PM6/9/22
to Boinc Projects
Hi,

With PHP 8.1, I'm seeing the following warning on some pages:

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/boincadm/projects/nfs/html/inc/boinc_db.inc on line 147

Casting the variable to type string is a quick and easy fix:
trim((string) $string)

Likewise in server_status.php, for apps with no results, I'm seeing

Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in /home/boincadm/projects/nfs/html/user/server_status.php on line 179

Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in /home/boincadm/projects/nfs/html/user/server_status.php on line 180

Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in /home/boincadm/projects/nfs/html/user/server_status.php on line 181

Likewise, casting to float is a quick fix:
round((float) $app->info->avg, 2)

Thanks,
Greg


Greg Childers

unread,
Jun 9, 2022, 4:42:09 PM6/9/22
to Boinc Projects
One more I just found...
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/boincadm/projects/nfs/html/inc/user.inc on line 247

Vitalii Koshura

unread,
Jun 9, 2022, 5:28:07 PM6/9/22
to Greg Childers, Boinc Projects
Hello Greg,

Thank you for your report.
First issue with 
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/boincadm/projects/nfs/html/inc/boinc_db.inc on line 147
should be now fixed via https://github.com/BOINC/boinc/pull/4769
As soon as you get an idea how to fix other issue, could you please create a PR on upstream here: https://github.com/BOINC/boinc/pulls ?

Thanks in advance.

Best regards,
Vitalii Koshura


чт, 9 июн. 2022 г. в 22:42, Greg Childers <jgchilde...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "boinc_projects" group.
To unsubscribe from this group and stop receiving emails from it, send an email to boinc_project...@ssl.berkeley.edu.
To view this discussion on the web visit https://groups.google.com/a/ssl.berkeley.edu/d/msgid/boinc_projects/CAPOvAR6sFNZw1wR6CxCM7c%2B4N9kfb5EyH1xXbH9JvLSmmL1xSg%40mail.gmail.com.

Greg Childers

unread,
Jun 9, 2022, 6:35:15 PM6/9/22
to Vitalii Koshura, Boinc Projects
I see now there's already a PR tracking these and more.

Thanks,
Greg
Reply all
Reply to author
Forward
0 new messages