CodeIgniter Forums
Time class big bug - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Time class big bug (/showthread.php?tid=84677)



Time class big bug - kenjis - 10-29-2022

We found a big bug in Time class.
The class is stated as immutable in the docs, but some methods can alter the object state.

We would like to fix the bug, but it is a breaking change.
If users are using following methods in Time, the result will be changed if the bug is fixed.
add()
modify()
setDate()
setISODate()
setTime()
sub()

Do you agree with fixing Time or not?
If you don't use Time or the methods above, you are not affected if Time is fixed.

See https://github.com/codeigniter4/CodeIgniter4/issues/6762 for details.


RE: Time class big bug - captain-sensible - 10-30-2022

i only use now(), so it looks like i won't be affected but in principle better to address bugs , so yes fix it please.


RE: Time class big bug - kenjis - 10-30-2022

(10-30-2022, 02:35 AM)captain-sensible Wrote: i only use now(), so it looks like i won't be affected  but in principle better to address  bugs  , so yes fix it please.

Thank you for reply.
Yes, now() does not use Time, so you won't be affected.


RE: Time class big bug - ozornick - 10-30-2022

Use modify(), but i can fix my code. not too critical


RE: Time class big bug - davis.lasis - 10-30-2022

Yes
Bug must be fixed, even if the fix makes breaking changes.
Others, all affected will must adapt to that.


RE: Time class big bug - InsiteFX - 10-31-2022

If we wait to fix the bug it will end up causing bigger problems later on, we should fix it now.


RE: Time class big bug - SubrataJ - 10-31-2022

in the last 2 projects, I started using time :p, It should be fixed at the earliest. Smile


RE: Time class big bug - kenjis - 11-02-2022

Thank you, all.

This bug will be fixed in v4.3.0.

See https://github.com/codeigniter4/CodeIgniter4/pull/6771