Support » Plugin: WP Nav Plus » Array offset null

  • It appears with the recent update to WordPress core 6.1 (running PHP8.1) there seems to be a few error/warning notifications around validating for null offsets. I’ve identified these issues down to 3 specific files, and the same if statement within them, I would suggest adding a null validation prior to the check to resolve the issues. Here are the files and the lines I would add the validations before.

    limit_offset.php – line 44

    //Suggest adding initial variable validation
    if ( $wp_nav_plus_limit_offset_options === null ){
    	return $items;
    }

    menu_segment.php – line 43

    //Suggest adding initial variable validation
    if ( $wp_nav_plus_menu_segment_options === null ){
    	return $items;
    }

    start_depth.php – line 54

    //Suggest adding initial variable validation
    if ( $wp_nav_plus_start_depth_options === null ){
    	return $items;
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matt Keys

    (@mattkeys)

    Hey Jennifer,

    Fun to see this plugin still has some life out there, it never really took off but I’m still proud of it 🙂

    At first read I thought you were reporting a PHP 8 related error, but I think you are actually talking about something else. That the check for a value on some of the plugin menu arguments isn’t handling values like -1, -2 correctly.

    Am I following you correctly? I have to admit I am actually a bit rusty on this plugin nowadays. It has been 6 years since writing it and 4 years since I’ve had to do any meaningful updates to it. But it sounds like you are probably describing a bug that has existed since day one.

    Plugin Author Matt Keys

    (@mattkeys)

    re-reading this with fresh eyes today. I’m not able to reproduce what you are seeing. Can you provide some example code of how your menu is using the parameters from this plugin, and the errors you are seeing?

    Thanks!

    Thread Starter Jennifer Dust

    (@jldust)

    Hi Matt,

    Thanks for taking a look at this, here is an example of the code we are using that we experienced the error message with.

    wp_nav_menu(
      array(
        'menu' => $sidebar_menu,
        'fallback_cb' => false,
        'container' => false,
        'start_depth' => 1,
        'depth' => 2
      )
    );
    Plugin Author Matt Keys

    (@mattkeys)

    Thanks for sharing that. It looks like a very typical use of this plugin. In my test environment that works as expected and doesn’t produce any errors. Testing with PHP 8.1.1 and WordPress 6.1.1. Using ACF Pro 6.0.7.

    Can you share the exact error text that you are seeing?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.