Support » Plugin: Post Expirator » Fatal Error on Line 34 of post-expirator.php ([] operator not supported for stri

  • Resolved davidrichied

    (@davidrichied)


    Hi,
    I started getting a fatal error after updating to PHP 7.2.

    Fatal error: Uncaught Error: [] operator not supported for strings in /nas/content/live/njbstaging/wp-content/plugins/post-expirator1/post-expirator.php:34 Stack trace: #0 [internal function]: postExpirator_plugin_action_links(‘<‘, ‘post-expirator1…’) #1 /nas/content/live/njbstaging/wp-includes/class-wp-hook.php(288): call_user_func_array(‘postExpirator_p…’, Array) #2 /nas/content/live/njbstaging/wp-includes/plugin.php(203): WP_Hook->apply_filters(‘<‘, Array) #3 /nas/content/live/njbstaging/wp-admin/includes/class-wp-plugins-list-table.php(695): apply_filters(‘plugin_action_l…’, Array, ‘post-expirator1…’, Array, ‘all’) #4 /nas/content/live/njbstaging/wp-admin/includes/class-wp-plugins-list-table.php(534): WP_Plugins_List_Table->single_row(Array) #5 /nas/content/live/njbstaging/wp-admin/includes/class-wp-list-table.php(1165): WP_Plugins_List_Table->display_rows() #6 /nas/content/live/njbstaging/wp-admin/includes/class-wp-list-table.php(1097): WP_List_Table->display_rows_or_placeholder() #7 /nas/content/live/njbstag in /nas/content/live/njbstaging/wp-content/plugins/post-expirator1/post-expirator.php on line 34

    Here’s what I did to fix the issue.

    I added $links = array(); to turn the $links variable into an array.

    function postExpirator_plugin_action_links($links, $file) {
    $links = array();
    $this_plugin = basename(plugin_dir_url(__FILE__)) . ‘/post-expirator.php’;
    if($file == $this_plugin) {
    $links[] = ‘‘ . __(‘Settings’, ‘post-expirator’) . ‘‘;
    }
    return $links;
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Fatal Error on Line 34 of post-expirator.php ([] operator not supported for stri’ is closed to new replies.