-
Same issue…
Description: When navigating to the WP Activity Log viewer (
/wp-admin/admin.php?page=wsal-auditlog), a fatalTypeErroroccurs under PHP 8.0+ / PHP 8.3.The issue stems from
WSAL\Helpers\WP_Helper::hide_unrelated_notices(), which iterates over registeredadmin_noticeshooks and callsstrtolower()on callback identifiers. When third-party plugins register anonymous functions, closures, or dynamically generated callbacks that WordPress assigns integer/numeric identifiers to, passing the integer directly tostrtolower()causes PHP 8.x to throw an uncaughtTypeError.Fatal Error Stack Trace:
[20-Aug-2026 05:28:54 UTC] PHP Fatal error: Uncaught TypeError: strtolower(): Argument #1 ($string) must be of type string, int given in /var/www/html/wp-content/plugins/wp-security-audit-log/classes/Helpers/class-wp-helper.php:656
Stack trace:
#0 /var/www/html/wp-content/plugins/wp-security-audit-log/classes/Helpers/class-wp-helper.php(656): strtolower(1243)
#1 /var/www/html/wp-content/plugins/wp-security-audit-log/classes/Helpers/class-wp-helper.php(537): WSAL\Helpers\WP_Helper::remove_unrelated_actions('admin_notices')
#2 /var/www/html/wp-includes/class-wp-hook.php(353): WSAL\Helpers\WP_Helper::hide_unrelated_notices('')
#3 /var/www/html/wp-includes/class-wp-hook.php(377): WP_Hook->apply_filters(NULL, Array)
#4 /var/www/html/wp-includes/plugin.php(523): WP_Hook->do_action(Array)
#5 /var/www/html/wp-admin/admin-header.php(151): do_action('admin_print_scr...')
#6 /var/www/html/wp-admin/admin.php(244): require_once('/var/www/html/w...')
#7 {main}
thrown in /var/www/html/wp-content/plugins/wp-security-audit-log/classes/Helpers/class-wp-helper.php on line 656Steps to Reproduce:
- Run WordPress on PHP 8.2 or 8.3.
- Have an active plugin or theme that registers an anonymous function or integer-identified hook to
admin_notices. - Navigate to WP Activity Log > Log Viewer (
page=wsal-auditlog). - Notice the critical error screen / fatal
TypeErrorindebug.log.
Environment:
- WordPress Version: 6.x / 7.x
- PHP Version: 8.3.x
- Plugin: WP Activity Log (wp-security-audit-log)
Suggested Fix:
In
/classes/Helpers/class-wp-helper.php, cast the parameter explicitly to a string or ensure it is a string/numeric value before passing it tostrtolower():// Existing:
strtolower( $callback_identifier )
// Suggested:
strtolower( (string) $callback_identifier )Workaround / Temporary Hotfix Applied:
To restore functionality while awaiting an upstream patch, a local type-cast hotfix was applied directly to
class-wp-helper.phpinside the container:- Target File:
/wp-content/plugins/wp-security-audit-log/classes/Helpers/class-wp-helper.php - Modification: Updated line 656 to explicitly typecast the hook callback identifier to a string prior to passing it to
strtolower():
// Modified from:
strtolower( $callback )
// Changed to:
strtolower( (string) $callback )Command Used:
sed -i 's/strtolower(\([^)]*\))/strtolower((string)\1)/g' /var/www/html/wp-content/plugins/wp-security-audit-log/classes/Helpers/class-wp-helper.phpResult: Explicitly typecasting the integer hook identifier (e.g.,
1242,1243) satisfies PHP 8.x strict scalar typing, immediately resolving the fatalTypeErrorand allowing the audit log viewer (page=wsal-auditlog) to load normally.-
This reply was modified 8 hours, 9 minutes ago by
patsitsolutions. Reason: Added workaround