• Resolved gmariani405

    (@gmariani405)


    PHP Warning:  Attempt to read property "current_options" on null in /chroot/home/.../wp-content/plugins/spiffy-calendar/includes/block.php on line 25

    I ran into this error when running WP-CLI. Might I suggest adding something like this at line 22 (after the global):

    if (!isset($spiffy_calendar)) {
      $spiffy_calendar = new stdClass();
      $spiffy_calendar->current_options = ['alphabetic_categories' => 'true'];
    }

    Or whatever to initialize the variable properly, just so it doesn’t throw an error. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Spiffy Plugins

    (@spiffyplugins)

    Thanks for reporting. Would it be better to quit the function completely if it’s not defined?

    // Quit if running WP-CLI
    if (!isset($spiffy_calendar)) {
    return;
    }

    Thread Starter gmariani405

    (@gmariani405)

    Possibly, since there isn’t any Block Editor to load that might make sense. I don’t know if there is any API exposed to WP-CLI so i can’t answer that specifically. But if you accessing the site with the plugin installed you should be able to make that call. Otherwise i THINK quitting would be fine.

    Plugin Author Spiffy Plugins

    (@spiffyplugins)

    I will add your suggested code in the next release. I have no way of testing myself, but it appears this will avoid the problem. Quitting the construction might cause other problems.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WP-CLI error: Attempt to read property “current_options” on null’ is closed to new replies.