• Resolved Stefano Lissa

    (@satollo)


    Hi, on a clean install WP 6.1.1 with PHP 8.1 there is a fatal error due to ltrim() used with an array in formatting.php, started by esc_url(). The problem appears in the plugin list when a plugin (like jetpack) has an SVG icon.

    In the class WP_Plugin_Install_List_Table line 740, the $plugin_icon_url for an SVG icon is an array, not an URL string. Probably the problem is in the plugin API e not in WP. Here is the “icon” for JetPack:

    [16-Mar-2023 06:30:15 UTC] Array
    (
        [filename] => icon.svg
        [revision] => 2819237
        [resolution] => 
        [location] => assets
        [locale] => 
    )

    while other plugin icons, like Akismet are like:

    [16-Mar-2023 06:48:27 UTC] https://ps.w.org/akismet/assets/icon-256x256.png?rev=2818463

    Thank you, Stefano.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Same here. In the debug.log, it shows this:

    PHP Fatal error: Uncaught TypeError: ltrim(): Argument #1 ($string) must be of type string, array given in wp-includes/formatting.php:4379

    On the “add plugin” page, it shows this error under Jetpack:

    There has been a critical error on this website. Please check your site admin email inbox for instructions.

    Deactivated all the plugins, reverted to the default theme, and still had the same issue. As soon as I switch back to PHP 7.4, the issue goes away.

    Currently, I’m on PHP 8.2. Tried both 8.1 and 8.0 and both had the same issue.

    I tried repairing and optimizing the database as well. Even performed a reinstallation of WordPress but the issue persists.

    Moderator Dion Hulse

    (@dd32)

    Meta Developer

    Hi @satollo and @impunk, this should now be resolved.

    Thread Starter Stefano Lissa

    (@satollo)

    I confirm, thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP 8.1 fatal error on plugin list with SVG icon’ is closed to new replies.