The Events Calendar
[resolved] bug: infinite loop in month calendar view, proposed patch (3 posts)

  1. erachen
    Posted 2 years ago #

    Using the-event-calendar version 3.1 with PHP Version 5.3.3-7+squeeze16

    I found that displaying calendar as list works
    i.e.: site/agenda/a-venir/

    but displaying as month make a infinite loop.
    i.e.: site/agenda/mois/

    On our installation the problem occur at:
    line 777, in function "dateDiff", the while statement never stop because the date does not increment.

    here is the patch we use to workaround it:
    --- tribe-event-query.class.php.orig 2013-11-04 20:28:42.791890593 +0100
    +++ tribe-event-query.class.php.new 2013-11-04 20:29:01.139597485 +0100
    @@ -770,11 +770,11 @@
    * @return int The number of days between two dates.
    public static function dateDiff( $date1, $date2 ) {
    - $current = $date1;
    + $datecurrent = date_create( $date1 );
    $datetime2 = date_create( $date2 );
    $count = 0;
    - while ( date_create( $current ) < $datetime2 ) {
    - $current = gmdate( "Y-m-d", strtotime( "+1 day", strtotime( $current ) ) );
    + while ( $datecurrent < $datetime2 ) {
    + $datecurrent->modify('+1 day');
    return $count;


  2. Barry Hughes
    Plugin Author

    Posted 2 years ago #

    Hi erachen: we haven't had any other reports that I can think of suggesting infinite loops were occurring. Can you confirm what steps we'd need to follow to replicate this and also confirm it occurs even with only a default theme and no other plugins running?


  3. Barry Hughes
    Plugin Author

    Posted 2 years ago #

    It's been a while without an update so I'll mark this as resolved. If you need further help though please feel free to post an update or create a new thread, whichever is appropriate.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • The Events Calendar
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic