{"id":18925736,"date":"2026-06-02T00:33:39","date_gmt":"2026-06-02T00:33:39","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/php-error-709\/"},"modified":"2026-06-02T00:33:39","modified_gmt":"2026-06-02T00:33:39","slug":"php-error-709","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/php-error-709\/","title":{"rendered":"PHP Error"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi Solid Security team,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I maintain a client site that&#8217;s hitting a fatal PHP error<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Environment<\/strong><\/p>\n\n\n\n<ul>\n<li>WordPress 7.0<\/li>\n\n\n\n<li>PHP 8.x<\/li>\n\n\n\n<li>Solid Security (better-wp-security)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What happens<\/strong><br \/>When the scheduled &#8220;digest&#8221; 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 \u2014 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Error<\/strong><br \/>Uncaught TypeError: preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given in \u2026\/wp-content\/plugins\/better-wp-security\/core\/lib.php:983<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Stack trace (condensed)<\/strong><br \/>preg_replace() \u2014 core\/lib.php:983 (fatal)<br \/>ITSEC_Lib::replace_tag(&#8216;\/{{ $user_coun\u2026\/&#8217;, &#8216;user_count&#8217;, Array) \u2014 core\/lib.php:983<br \/>ITSEC_Lib::replace_tags(\u2026) \u2014 core\/lib.php:996<br \/>ITSEC_Mail-&gt;replace_all(\u2026) \u2014 core\/lib\/class-itsec-mail.php:946<br \/>ITSEC_Mail-&gt;add_lockouts_summary(Array, Array) \u2014 core\/lib\/class-itsec-mail.php:330<br \/>ITSEC_Notify-&gt;send_daily_digest(\u2026) \u2014 core\/notify.php:156<br \/>ITSEC_Notification_Center-&gt;send_scheduled_notification(&#8216;digest&#8217;)<br \/>(triggered via the init hook \/ WP-Cron)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-18925736","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18925736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18925736\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18925736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}