Add more logging to investigate the 28th problem on issue #248

I reckon this is useful logging to have, keep it around.
This commit is contained in:
Andrew Ruthven 2022-12-15 18:04:53 +13:00 committed by Andrew Ruthven
parent 7d0e2f2435
commit 6e68c221e9

View File

@ -366,13 +366,14 @@ class RepeatRuleDateTime extends DateTime {
if ( isset($matches[8]) && $matches[8] != '' ) $interval .= $minus . $matches[9] . ' minutes ';
if (isset($matches[10]) &&$matches[10] != '' ) $interval .= $minus . $matches[11] . ' seconds ';
}
// printf( "Modify '%s' by: >>%s<<\n", $this->__toString(), $interval );
if ( DEBUG_RRULE) dbg_error_log( 'RRULE', "Modify '%s' by: >>%s<<\n", $this->__toString(), $interval );
// print_r($this);
if ( !isset($interval) || $interval == '' ) $interval = '1 day';
if ( parent::format('d') > 28 && strstr($interval,'month') !== false ) {
$this->setDate(null,null,28);
}
parent::modify($interval);
if (DEBUG_RRULE) dbg_error_log( 'RRULE', "Modified to '%s'", $this->__toString() );
return $this->__toString();
}
@ -837,6 +838,7 @@ class RepeatRule {
$this->current_set = array( clone($this->current_base) );
foreach( self::rrule_expand_limit($this->freq) AS $bytype => $action ) {
if ( isset($this->{$bytype}) ) {
if ( DEBUG_RRULE ) dbg_error_log( 'RRULE', "Going to find more instances by running %s_%s()", $action, $bytype );
$this->{$action.'_'.$bytype}();
if ( !isset($this->current_set[0]) ) break;
}
@ -847,6 +849,7 @@ class RepeatRule {
$position = count($this->instances) - 1;
if ( DEBUG_RRULE ) dbg_error_log( 'RRULE', "Inserting %d from current_set into position %d", count($this->current_set), $position + 1 );
foreach( $this->current_set AS $k => $instance ) {
if ( $instance < $this->base ) continue;
if ( isset($this->until) && $instance > $this->until ) {