When iterating \DatePeriod object in latte, it works fine, but when using {sep} it skips to every other DateTime object. So the result is for example 2021-01-01, 2021-01-03, ...
It is only in case of PHP 8.0, PHP 7.4 works as expected.
Steps To Reproduce
public function renderDefault() {
$start = \DateTime::createFromFormat("Y-m-d", "2021-01-01");
$end = \DateTime::createFromFormat("Y-m-d", "2021-01-30");
$this->template->period = new \DatePeriod($start, \DateInterval::createFromDateString('1 day'), $end)
}
{foreach $period as $day}
{$day|date:'Y-m-d'}{sep}<br/>{/sep}
{/foreach}
Results in
2021-01-01
2021-01-03
2021-01-05
...
Possible Solution
It is caused by \Latte\Runtime\CachingIterator::isLast() call, and when calling \Latte\Runtime\CachingIterator::hasNext() it is broken as well.
But when using PHP's \CachingIterator::hasNext() it looks like everything is fine.
But I have no idea how to fix this.
Version: latte 2.10.3, PHP 8.0.6
Bug Description
When iterating \DatePeriod object in latte, it works fine, but when using {sep} it skips to every other DateTime object. So the result is for example 2021-01-01, 2021-01-03, ...
It is only in case of PHP 8.0, PHP 7.4 works as expected.
Steps To Reproduce
Results in
Possible Solution
It is caused by
\Latte\Runtime\CachingIterator::isLast()
call, and when calling\Latte\Runtime\CachingIterator::hasNext()
it is broken as well. But when using PHP's\CachingIterator::hasNext()
it looks like everything is fine. But I have no idea how to fix this.