Add more logging to try and find the root cause for issue 268

This commit is contained in:
Andrew Ruthven 2022-12-14 20:20:36 +13:00
parent 3909ec52f1
commit 0fdb3ff558

View File

@ -732,11 +732,26 @@ class RepeatRule {
public function current($return_floating_times=false) {
if ( !$this->valid() ) return null;
if ( !$this->valid() ) {
if ( DEBUG_RRULE ) dbg_error_log( 'RRULE', 'current: not valid at top, return null' );
return null;
}
if ( !isset($this->instances[$this->position]) ) $this->GetMoreInstances($return_floating_times);
if ( !$this->valid() ) return null;
if ( !isset($this->instances[$this->position]) ) {
if ( DEBUG_RRULE ) dbg_error_log( 'RRULE', "current: \$this->instances[%s] isn't set, return null", $this->position );
return null;
}
if ( !$this->valid() ) {
if ( DEBUG_RRULE ) dbg_error_log( 'RRULE', 'current: not valid after GetMoreInstances, return null' );
return null;
}
if ( DEBUG_RRULE ) dbg_error_log( 'RRULE', "Returning date from position %d: %s (%s)", $this->position,
$this->instances[$this->position]->format('c'), $this->instances[$this->position]->FloatOrUTC($return_floating_times) );
return $this->instances[$this->position];
}
@ -813,7 +828,7 @@ class RepeatRule {
$this->current_base->modify( $this->frequency_string );
}
if ( $return_floating_times ) $this->current_base->setAsFloat();
if ( DEBUG_RRULE ) dbg_error_log( 'RRULE', "Getting more instances from: '%s' - %d, TZ: %s", $this->current_base->format('c'), count($this->instances), $this->current_base->getTimeZone() );
if ( DEBUG_RRULE ) dbg_error_log( 'RRULE', "Getting more instances from: '%s' - %d, TZ: %s, Loop: %s", $this->current_base->format('c'), count($this->instances), $this->current_base->getTimeZone(), $loops );
$this->current_set = array( clone($this->current_base) );
foreach( self::rrule_expand_limit($this->freq) AS $bytype => $action ) {
if ( isset($this->{$bytype}) ) {
@ -1250,6 +1265,8 @@ function expand_event_instances( vComponent $vResource, $range_start = null, $ra
$range_end->modify('+6 months');
}
dbg_error_log('RRULE', 'Expand event instances, start: %s, end: %s', $range_start, $range_end);
$instances = array();
$expand = false;
$dtstart = null;