crashes with Call to undefined method RRule\RSet::rewind()

Created on 18 March 2024, 9 months ago

Problem/Motivation

I have code which calls:

$iterator = $recur_field->first()->getHelper()
$iterator->rewind();

This causes this crash:

Error: Call to undefined method RRule\RSet::rewind() in Drupal\date_recur\Rl\RlHelper->rewind() (line 252 of modules/contrib/date_recur/src/Rl/RlHelper.php).

Drupal\date_recur\DateRecurHelper->rewind() (Line: 90)

The Iterator interface was removed from rlanvin/php-rrule's RSet class in commit 5a23f0e03b53a23d2190cf1f8f905f8118a3296c:

commit 5a23f0e03b53a23d2190cf1f8f905f8118a3296c
Author: rlanvin <remi@cloudconnected.fr>
Date:   Fri Oct 4 22:57:28 2019 +0100

    Remove Iterator interface implementation from RSet

    Was replaced by IteratorAggregate interface in v2.0

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Checklist ✔

[[Remove this:] Replace ❌ with ✔ where applicable]

  • [ ❌ ] Changeset meets coding standards and project style guide .
  • [ ❌ ] Changeset has tests
  • [ ❌ ] Proposal has been discussed externally (Slack/IRC)
🐛 Bug report
Status

Active

Version

3.5

Component

Code

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joachim
  • 🇬🇧United Kingdom joachim

    It looks like we could fix this by adding calls to ->getIterator() but my code is now infinite looping, so need to check that...

  • 🇦🇺Australia dpi Perth, Australia

    Thanks, looks like a good change.

    I guess there is no coverage, could be added in \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest.

    Seems like not many use it, and there is at least workarounds (getRlRuleset()). So reducing severity.

Production build 0.71.5 2024