Pierre-Lannoy / wp-decalog

Capture and log events, metrics and traces on your site. Make WordPress observable - finally!
https://perfops.one/
GNU General Public License v3.0
64 stars 9 forks source link

Fix deprecation warning in PHP8+ #46

Closed stevapple closed 1 year ago

stevapple commented 1 year ago

Fixes the following warning on PHP 8+:

PHP Deprecated:  explode(): Passing null to parameter #2 ($string) of type string is deprecated in 
.../wp-content/plugins/decalog/includes/system/class-ip.php on line 99

which is actually caused by type mismatch.

Pierre-Lannoy commented 1 year ago

Hello @stevapple ! Thanks for the PR. Unfortunately, I will not be able to merge it for "WP plugin directory" compatibility reason - mandatory use of filter_input() function. Nevertheless, I suggest you to resubmit a PR with unchanged first condition but with null coalescing for filter_input() result. Something like (string) filter_input( INPUT_SERVER, $field ) ?? '' instead of filter_input( INPUT_SERVER, $field ). Thanks.