[dev] Infinite loops in Kronolith with certain recurring events.
Michael Rubinsky
mrubinsk at horde.org
Sat Oct 18 20:20:03 UTC 2008
Ok. This was a royal PITA. This is what I found regarding the issues
I was having with kronolith going into an endless loop with certain
recurring events. It boils down to that fact that
DateTime->format('W') returns the first week of the year for a date
like 12/29/2008 so that when calculating the after_week and
after_week_end values in nextRecurrnece() the after_week value is set
to the first week of 2007. So the code chokes when calling
nextRecurrence() with an after date of 12/29/08. Example code
(basically code that is executed during nextRecurrence() and the
methods it calls):
<code>
$after = new Horde_Date(array('year' => 2008, 'month' => 12, 'day' => 29));
$dt = new DateTime();
$dt->setDate($after->year, $after->month, $after->mday);
$dt->setTime($after->hour, $after->min, $after->sec);
//$weekNumber gets set to '01'
$weekNumber = $dt->format('W');
$after_week = Horde_Date::firstDayOfWeek($weekNumber, $after->year);
echo $after_week;
</code>
outputs 12/31/2007 instead of expected 12/29/08 (since that date IS
the start of the week).
So, we need to check if the ->format('W') call rolls into the next
year before we calculate $after_week. I'll keep at it....just glad I
finally nailed what was going on after way too many hours of digging :)
Thanks,
mike
--
The Horde Project (www.horde.org)
mrubinsk at horde.org
"Time just hates me. That's why it made me an adult." - Josh Joplin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: PGP Digital Signature
URL: <http://lists.horde.org/archives/dev/attachments/20081018/2257463b/attachment.bin>
More information about the dev
mailing list