Support » Plugin: Imsanity » PHP 7.1 incompatability

  • Resolved lukesnider

    (@lukesnider)


    There is an issue with PHP 7.1. We get the following error when trying to access the backend.
    Fatal error: Uncaught Error: [] operator not supported for strings in /www/wp-content/plugins/imsanity/settings.php:54

    /**
    * Settings link that appears on the plugins overview page
    * @param array $links
    * @return array
    */
    function imsanity_settings_link( $links ) {
    $links[] = ‘‘ . esc_html__( ‘Settings’, ‘imsanity’ ) . ‘‘;
    return $links;
    }

    This can be fixed by simply instantiating the array before accessing it as such within the function.

    Please push an update ASAP.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author nosilver4u

    (@nosilver4u)

    Thanks for letting me know. I have a couple other small tweaks I want to get into the next release, so I’ll work on putting something together for this next week.

    Plugin Author nosilver4u

    (@nosilver4u)

    That’s going to be a few weeks, as I’ll be on vacation (forgot about that when I replied yesterday).

    Plugin Author nosilver4u

    (@nosilver4u)

    back from vacation, have a fix in place, but have at least one other thing I want to work on before releasing it. If you like, I can push the change to SVN so you can grab it ahead of time.

    Plugin Author nosilver4u

    (@nosilver4u)

    Upon further testing, the actions item is always supposed to be an array. If it is a string when it gets to imsanity_settings_link(), then some other plugin/theme is doing something incorrectly. See:
    https://developer.wordpress.org/reference/hooks/plugin_action_links_plugin_file/
    https://developer.wordpress.org/reference/hooks/plugin_action_links/

    My “fix” will only turn the fatal error into a warning, so you’ll need to track down what else is mucking with the plugin action links. If you see anything besides Settings and Deactivate on your plugins page, that’s a good clue.

    neotechnomad

    (@neotechnomad)

    Not to barge in, but this is also within the scope of this post.
    I ran a Compatibility Scan with this plugin – PHP Compatibility Checker by WP Engine – before upgrading to PHP 7.0and the report found the following:

    FILE: /home/coopvois/public_html/wp-content/plugins/imsanity/imsanity.php
    ----------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     223 | ERROR | The function imagecreatefrombmp() is not present in PHP version 7.1 or earlier
    ----------------------------------------------------------------------------------------------

    Do you need to address these before I upgrade to 7.0?

    Plugin Author nosilver4u

    (@nosilver4u)

    @neotechnomad, Imsanity includes it’s own version of that function in case it is missing (which it was until version 7.2). I haven’t specifically tested it with 7.2, but I would suspect the version in 7.2 should behave similarly to the Imsanity-bundled one (probably better).
    At any rate, none of that matters if you don’t upload BMP (bitmap) images to your site 🙂

    neotechnomad

    (@neotechnomad)

    @nosilver4u,

    Thanks for the quick reply.
    I don’t allow bmp’s on the sites, so this is a non-issue.

    I am also getting something similar
    Fatal error: Uncaught Error: [] operator not supported for strings in /var/www/vhosts/servicedeskinstitute.com/subdomains/dev1/httpdocs/wp-content/plugins/imsanity/settings.php:54 Stack trace: #0 /var/www/vhosts/servicedeskinstitute.com/subdomains/dev1/httpdocs/wp-includes/class-wp-hook.php(288): imsanity_settings_link(‘<‘) #1 /var/www/vhosts/servicedeskinstitute.com/subdomains/dev1/httpdocs/wp-includes/plugin.php(203): WP_Hook->apply_filters(‘<‘, Array) #2 /var/www/vhosts/servicedeskinstitute.com/subdomains/dev1/httpdocs/wp-admin/includes/class-wp-plugins-list-table.php(714): apply_filters(‘plugin_action_l…’, ‘<‘, ‘imsanity/imsani…’, Array, ‘all’) #3 /var/www/vhosts/servicedeskinstitute.com/subdomains/dev1/httpdocs/wp-admin/includes/class-wp-plugins-list-table.php(534): WP_Plugins_List_Table->single_row(Array) #4 /var/www/vhosts/servicedeskinstitute.com/subdomains/dev1/httpdocs/wp-admin/includes/class-wp-list-table.php(1165): WP_Plugins_List_Table->display_rows() #5 /var/www/vhosts/servicedeskinstitute.com/subdomains in /var/www/vhosts/servicedeskinstitute.com/subdomains/dev1/httpdocs/wp-content/plugins/imsanity/settings.php on line 54

    except it is stopping my plugins displaying at
    wp-admin/plugins.php
    so a fix asap would be appreciated

    Plugin Author nosilver4u

    (@nosilver4u)

    @sd360, please disable all plugins except Imsanity and switch to a default theme, does the problem still occur?

    Plugin Author nosilver4u

    (@nosilver4u)

    did anyone ever track down which other plugin was interfering with the settings links?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘PHP 7.1 incompatability’ is closed to new replies.