PHP Warning tribe-Events-recurrence-meta.class.php

Home Forums Calendar Products Events Calendar PRO PHP Warning tribe-Events-recurrence-meta.class.php

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #43542
    Bob
    Participant

    Hi,

    In a situation I’ll describe below, I’m getting the following PHP warning: “Warning: Creating default object from empty value in wp-content\plugins\Events-calendar-pro\lib\tribe-Events-recurrence-meta.class.php on line 46”. This is only an annoyance, since it doesn’t appear unless PHP display_errors is set to “on”. However, I THINK it represents a minor bug in Events Pro.

    Line 46 is part of function admin_bar_render. The statement says:

    $edit_link->href = $edit_link->href . ‘&EventDate=’ . TribeDateUtils::dateOnly($post->EventStartDate);

    I believe this is intended to make sure that, when a user decides to edit a recurring Event, the Edit link takes him/her to an edit screen for desired Event date (rather than the first occurrence of the recurring Event).

    I think the assumption behind this is that the code only gets called when the user is viewing a single instance of the recurring Event.

    However, if the recurring Event is the last Event appearing in a listing of multiple Events, admin_bar_render gets called and sets $edit_link to null. Line 46 then attempts to execute, resulting in the PHP warning.

    This quick-fix resolved the warning for me:

    if ($edit_link) {$edit_link->href = …}

    However, I suspect it would be better if the original condition in admin_bar_render was expanded to make sure it covers the multiple event listing situation I described. Or maybe there’s more to the story.

    Let me know what you think and/or if you have any questions. Thanks!

    #43702
    Jonah
    Participant

    Hi Bob,

    I’ve passed this on to one of our developers to check. Thanks for the report. I’ll let you know what they get back with.

    Thanks,
    Jonah

    #47581
    Jonah
    Participant

    Hi Bob,

    Sorry for never following back up here. Would you be willing to test things out with our 3.0 beta to see if this is addresses there? If so, please shoot an email over to pro [at] tri [dot] be with a request to test.

    Thanks,
    Jonah

    #47776
    Bob
    Participant

    Sure, I’ll do that.
    Thanks.
    Bob

    #47863
    Jonah
    Participant

    Sounds good Bob, let us know if there’s anything else I can do for you here.

    – Jonah

    #48696
    Bob
    Participant

    I’ve just tested with the 3.0 beta, and the problem appears to be fixed! Thanks.

    (By the way, while making sure I could duplicate the error before upgrading the test environment to the 3.0 beta, I discovered one more condition necessary for the error to occur: the user needs to be logged in. Since the error appears to be fixed in the 3.0 beta, I haven’t bothered to figure out why.)

    #48707
    Jonah
    Participant

    Hi Bob,

    Glad to hear it’s fixed in 3.0 since we won’t be making any other updates to the pre 3.0 code. You’re welcome to continue using the beta until we launch at which point you can auto update to the latest. Let me know if you need anything else here.

    Regards,
    Jonah

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘PHP Warning tribe-Events-recurrence-meta.class.php’ is closed to new replies.