PHP Error
-
Hi Solid Security team,
I maintain a client site that’s hitting a fatal PHP error
Environment
- WordPress 7.0
- PHP 8.x
- Solid Security (better-wp-security)
What happens
When the scheduled “digest” notification fires, the plugin crashes while building the lockouts summary section of the email. The fatal call is preg_replace() being passed a string pattern but an array replacement — PHP 8 requires the pattern to also be an array in that case. The user_count tag appears to be passed into replace_tag() as an array rather than a scalar.Error
Uncaught TypeError: preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given in …/wp-content/plugins/better-wp-security/core/lib.php:983Stack trace (condensed)
preg_replace() — core/lib.php:983 (fatal)
ITSEC_Lib::replace_tag(‘/{{ $user_coun…/’, ‘user_count’, Array) — core/lib.php:983
ITSEC_Lib::replace_tags(…) — core/lib.php:996
ITSEC_Mail->replace_all(…) — core/lib/class-itsec-mail.php:946
ITSEC_Mail->add_lockouts_summary(Array, Array) — core/lib/class-itsec-mail.php:330
ITSEC_Notify->send_daily_digest(…) — core/notify.php:156
ITSEC_Notification_Center->send_scheduled_notification(‘digest’)
(triggered via the init hook / WP-Cron)Thanks!
You must be logged in to reply to this topic.