PHP 8.3 fatal error in WP Cerber - mb_strlen() receives array in cerber_mask_fields()

Hello,

I am seeing repeated fatal errors from WP Cerber on a live WooCommerce site.

The error is:

PHP Fatal error: Uncaught TypeError: mb_strlen(): Argument #1 ($string) must be of type string, array given in /wp-content/plugins/wp-cerber/cerber-load.php:7682

The stack trace shows:

cerber_mask_fields(Array)
cerber_traffic_log()

Example trace:

PHP Fatal error: Uncaught TypeError: mb_strlen(): Argument #1 ($string) must be of type string, array given in /wp-content/plugins/wp-cerber/cerber-load.php:7682
Stack trace:
#0 /wp-content/plugins/wp-cerber/cerber-load.php(7682): mb_strlen(Array)
#1 /wp-content/plugins/wp-cerber/cerber-load.php(7299): cerber_mask_fields(Array)
#2 /wp-content/plugins/wp-cerber/cerber-load.php(7023): cerber_traffic_log()
#3 [internal function]: {closure}()
#4 {main}

This repeated many times within a short period, so it is not a one-off notice. It is a real fatal crash path.

From the trace, it looks like Cerber traffic logging/masking code sometimes receives an array where a string is expected, and then passes that array directly into mb_strlen().

Could you please check this and advise whether you already have a fix or patched version?

It looks like cerber_mask_fields() needs to safely handle non-string values before calling string functions.

Thank you

Hi Zalboh,

Thank you for reporting this. Which version of WP Cerber are you using?

Version 9.7.3
PHP 8.3
Latest WordPress + Woocommerce

I can confirm this is a bug. It will be fixed in the next release.

1 Like