diff -Naur WebCalendar-1.2.0.orig/includes/functions.php WebCalendar-1.2.0.new/includes/functions.php --- WebCalendar-1.2.0.orig/includes/functions.php 2009-01-26 12:57:29.000000000 +0100 +++ WebCalendar-1.2.0.new/includes/functions.php 2009-01-26 13:06:09.000000000 +0100 @@ -2293,6 +2293,14 @@ $byxxxDay = ''; $dayTxt = substr ( $day, -2, 2 ); $dayOffset = substr_replace ( $day, '', -2, 2 ); + + // It is possible to have spurious offset days within a 'daily' repetition, + // by setting them while in month/year repetition type, then changing + // type to 'daily'. + // These situations will lead in a crash without the following test. + if (is_numeric($dayOffset) && !isset($ditype)) + continue; + $dowOffset = ( ( -1 * $byday_values[$dayTxt] ) + 7 ) % 7; //SU=0, MO=6, TU=5... if ( is_numeric ( $dayOffset ) && $dayOffset > 0 ) { // Offset from beginning of $type.