• Same issue…

    Description: When navigating to the WP Activity Log viewer (/wp-admin/admin.php?page=wsal-auditlog), a fatal TypeError occurs under PHP 8.0+ / PHP 8.3.

    The issue stems from WSAL\Helpers\WP_Helper::hide_unrelated_notices(), which iterates over registered admin_notices hooks and calls strtolower() 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 to strtolower() causes PHP 8.x to throw an uncaught TypeError.

    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 656

    Steps to Reproduce:

    1. Run WordPress on PHP 8.2 or 8.3.
    2. Have an active plugin or theme that registers an anonymous function or integer-identified hook to admin_notices.
    3. Navigate to WP Activity Log > Log Viewer (page=wsal-auditlog).
    4. Notice the critical error screen / fatal TypeError in debug.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 to strtolower():

    // 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.php inside 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.php

    Result: Explicitly typecasting the integer hook identifier (e.g., 1242, 1243) satisfies PHP 8.x strict scalar typing, immediately resolving the fatal TypeError and 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