10up / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
1.23k stars 312 forks source link

PHP 8.2: Warnings about deprecated usage of strtolower #3944

Open MattWilliamsDev opened 3 weeks ago

MattWilliamsDev commented 3 weeks ago

While running a network-wide sync, we saw numerous instances of Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php on line 297.

Some of the items we were syncing did not have label['plurals'] defined, leading to null being passed to esc_html( strtolower( $indexable->labels['plural'] ) ), spurring the warning. While this can certainly be avoided in the implementation, I also believe simple steps could be taken to safeguard against this warning.

burhandodhy commented 3 weeks ago

Hi @MattWilliamsDev,

Thank you for reporting the bug. We will try to have it fixed in the next version. Would you like to open a Pull Request with the fix? Thanks!

MattWilliamsDev commented 3 weeks ago

Hi @MattWilliamsDev,

Thank you for reporting the bug. We will try to have it fixed in the next version. Would you like to open a Pull Request with the fix? Thanks!

I will try and put something in tomorrow if possible. Holiday today.