Increase loop limit for finding next instance for Recurrence Rules.

With complex rules, it make take more than 10 expansions to find the
next valid date. Increase this to 100, it doesn't slow things down too
much.

I've also added some additional error logging if this issue occurs
again.

Closes #268.
This commit is contained in:
Andrew Ruthven 2022-12-14 20:22:49 +13:00
parent 0fdb3ff558
commit d93a5196b8

View File

@ -817,10 +817,15 @@ class RepeatRule {
private function GetMoreInstances($return_floating_times=false) {
if ( $this->finished ) return;
$got_more = false;
$loop_limit = 10;
$loop_limit = 100;
$loops = 0;
if ( $return_floating_times ) $this->base->setAsFloat();
while( !$this->finished && !$got_more && $loops++ < $loop_limit ) {
while( !$this->finished && !$got_more) {
if ($loops++ > $loop_limit ) {
dbg_error_log ('ERROR', "RRULE, loop limit has been hit in GetMoreInstances, this probably needs to be increased (loop_limit: %d)", $loop_limit);
break;
}
if ( !isset($this->current_base) ) {
$this->current_base = clone($this->base);
}