• Resolved Ian Pegg

    (@ianpegg)


    Thanks for the update to 3.2 guys – looks like you’ve fixed a lot of issues. Unfortunately however I’m now getting a Fatal when I go to an event category page:

    PHP Catchable fatal error: Object of class stdClass could not be converted to string in <directory-path>/plugins/the-events-calendar/lib/tribe-template-factory.class.php on line 265

    Thanks for your help!

    http://wordpress.org/plugins/the-events-calendar/

Viewing 13 replies - 1 through 13 (of 13 total)
  • I don’t actually experience this on a stock installation – just WordPress, our plugin and a default theme – can you confirm if you find the same (ie, have you tried this without any other plugins and only an unmodified copy of Twenty Twelve running)?

    Thanks!

    Thread Starter Ian Pegg

    (@ianpegg)

    Thanks for your reply Barry. I’ll give that a try over the weekend if I get the chance and report back.

    Hi Barry
    I am facing the same issue, but can narrow down the cause. Whenever I call the Event Detail page and there is no upcoming event, the fatal error appears.

    I didn´t try this without any other plugins and only an unmodified copy of Twenty Twelve running so far.

    Thanks for quick response and fix,
    Paul

    Thread Starter Ian Pegg

    (@ianpegg)

    Hello Barry,

    Today I tried a fresh install of TEC 3.2 on a copy of WP I’ve been using for a while, which just has the Twenty-Thirteen theme and a bunch of standard plugins I use all the time. It worked fine and I was able to create event categories (and sub-categories), assign those categories to event posts, and then view the event category pages in month and list mode without issue.

    I think it might help you to read through the issue that I’m having however, as there may be something that’s been overlooked. Whether I look at an events category page that has any events assigned to it or not, I’m still getting the same error – it’s not related to there being no events to display as far as I can tell.

    On the site that I’m still having issues with, I can view an events category page (e.g <domain.com/events/category/<event-category>/) in month layout just fine, but if I switch to list view I get the following error in set_notices() inside lib/tribe-template-factory.php on line 265:

    TribeEvents::setNotice( 'events-not-found', sprintf( __('No matching events listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar') . $tax_term ) )

    It seems that $tax_term is expected to be a string, since it is initialised as one at the top of the function:

    $tax_term = '';

    This variable is then assigned a value in only one place, and only if this condition evaluates as true:

    $tribe->get_event_taxonomy()

    Which it does in my case, or else I wouldn’t be getting my error about object to string conversion. Within this conditional, the following assignment is made:

    $tax_term = get_term_by( 'slug', get_query_var( 'term' ), $tribe->get_event_taxonomy() );

    The WordPress codex states that the output for get_term_by can be either OBJECT, ARRAY_A, or ARRAY_N, with a default of OBJECT. Since $output is set by parameter 4 (which is not present in this case) then we must assume the returned value is going to be an object.

    That’s all fine, but the code that comes later (and that is responsible for the error) prints a message using sprintf, which assumes $tax_term will be a string.

    I was able to hack a fix by assigning before the problem code:

    $tax_term = $tax_term->name;

    This obviously assigns the string object variable to $tax_term, but I get the feeling something is missing here. Maybe I’ve misunderstood something?

    Thanks for your help

    No, you’re pretty much right and I simply missed that the category page typically has to be devoid of events to experience this. We’ve got a fix in the works for this, but by the looks of things you’ve pretty much put in place the same correction.

    Apologies for the inconvenience.

    Thread Starter Ian Pegg

    (@ianpegg)

    No need to apologise, we all make mistakes. You guys have created an amazing plugin, and you listen to your community, so thank you. It’s also great to see proper object-oriented code in a WordPress plugin, that doesn’t happen very often in my experience!

    Version 3.2 does not work with my theme Hottopix. Once I install The Events Calendar, my featured post area turns into an empty black box. I’ve uninstalled the plugin until I can have someone take a look. The website is http://www.nolablackprofessionals.com

    ianpegg, thanks to your posting I found a rather simple error that needs correction in addition to your patch:

    TribeEvents::setNotice( 'events-not-found', sprintf( __('No upcoming events listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar') . $tax_term ) );

    should be:

    TribeEvents::setNotice( 'events-not-found', sprintf( __('No upcoming events listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar') , $tax_term ) );

    So dot before $tax_term should obviously be replaced by a colon.

    Code at line 250 should be:

    if ( is_tax( $tribe->get_event_taxonomy() ) ) {
         $tax_term = get_term_by( 'slug', get_query_var( 'term' ), $tribe->get_event_taxonomy());
         $tax_term = $tax_term->name;
    }

    Thread Starter Ian Pegg

    (@ianpegg)

    You’re absolutely right to point this out drummerroma – I left that part out to try and keep my explanation short, but in retrospect I should’ve given more thought to others who might be having the same problem.

    Thanks for providing the additional information! Hope my post was useful to you.

    10iesha,

    Version 3.2 does not work with my theme Hottopix. Once I install The Events Calendar, my featured post area turns into an empty black box. I’ve uninstalled the plugin until I can have someone take a look.

    Please don’t hijack other people’s threads with separate issues. Instead, create a new thread of your own and someone will help you as quickly as they can.

    Thanks!

    Hi Barry,

    I got same fatal error

    Catchable fatal error: Object of class stdClass could not be converted to string in /homez.620/fvrcweb/www/wp-content/plugins/the-events-calendar/lib/tribe-template-factory.class.php on line 265

    Using responsive Pro theme.

    Thanks for your help and thanks for your plugin!

    I know you’re working on this fix; any news on when this will be released?

    Soon!

    It’s literally in the final stages of preparation.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘3.2 Fatal Error’ is closed to new replies.