PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Date and Time » Calendar » Bug #3183

Problem with Calendar_Util_textual and gmmktime()

Details

Submitted2005-01-13 02:38 UTC
Fromchris at deskpro dot com
Assignedquipo
StatusClosed
PackageCalendar
PHP Version4.3.10
OSWin, probably all
Roadmaps(Not assigned)

Comments

[2005-01-13 02:38 UTC] chris at deskpro dot com

Description:
------------
This is somewhere between a bug and a request, probably more of a request in fact.

I have modified this excellent class to use gmmktime and gmdate in all situations, I did some testing but was having no problems.

Until ... I tried to use the week utility to get back the days of the week for a given class. It was broken.

So I ran the all_tests.php code (so useful, thank you!) after replacing all the mktime and date calls inside it.

The results show that everything works except Calendar_Util_Textual. I got:

29/29 test cases complete: 804 passes, 26 fails and 0 exceptions.

This is brilliant in the fact that everything else works, and this class I realise is an "extra" and not a core class. Still, it would be even better if it where to work with gmdate as well.

If possible a fix would be great, otherwise a direction into where this is going wrong would be just as useful.

Just an asside, thanks to the developers for such a useful class!

Reproduce code:
---------------
I am just listing here the failed tests from all_tests.php:

Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testmonthnameslong -> Equal expectation fails with member [1] at character 0 with [January] and [December] at line [29]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testmonthnamesshort -> Equal expectation fails with member [1] at character 0 with [Jan] and [Dec] at line [47]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testmonthnamestwo -> Equal expectation fails with member [1] at character 0 with [Ja] and [De] at line [65]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testmonthnamesone -> Equal expectation fails with member [1] at character 0 with [J] and [D] at line [83]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testweekdaynameslong -> Equal expectation fails with member [0] at character 1 with [Sunday] and [Saturday] at line [96]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testweekdaynamesshort -> Equal expectation fails with member [0] at character 1 with [Sun] and [Sat] at line [109]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testweekdaynamestwo -> Equal expectation fails with member [0] at character 1 with [Su] and [Sa] at line [122]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testweekdaynamesone -> Equal expectation fails with member [1] at character 0 with [M] and [S] at line [135]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testprevmonthnameshort -> Equal expectation fails at character 0 with [Sep] and [Aug] at line [139]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testthismonthnameshort -> Equal expectation fails at character 0 with [Oct] and [Sep] at line [143]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testnextmonthnameshort -> Equal expectation fails at character 0 with [Nov] and [Oct] at line [147]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testthisdaynameshort -> Equal expectation fails at character 0 with [Wed] and [Tue] at line [151]
Fail: Decorator Tests -> decorator_textual_test.php -> Test of Calendar_Decorator_Textual -> testorderedweekdaysshort -> Equal expectation fails with member [0] at character 1 with [Sun] and [Sat] at line [164]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testmonthnameslong -> Equal expectation fails with member [1] at character 0 with [January] and [December] at line [58]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testmonthnamesshort -> Equal expectation fails with member [1] at character 0 with [Jan] and [Dec] at line [75]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testmonthnamestwo -> Equal expectation fails with member [1] at character 0 with [Ja] and [De] at line [92]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testmonthnamesone -> Equal expectation fails with member [1] at character 0 with [J] and [D] at line [109]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testweekdaynameslong -> Equal expectation fails with member [0] at character 1 with [Sunday] and [Saturday] at line [121]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testweekdaynamesshort -> Equal expectation fails with member [0] at character 1 with [Sun] and [Sat] at line [133]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testweekdaynamestwo -> Equal expectation fails with member [0] at character 1 with [Su] and [Sa] at line [145]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testweekdaynamesone -> Equal expectation fails with member [1] at character 0 with [M] and [S] at line [157]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testprevmonthnameshort -> Equal expectation fails at character 0 with [Sep] and [Aug] at line [160]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testthismonthnameshort -> Equal expectation fails at character 0 with [Oct] and [Sep] at line [163]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testnextmonthnameshort -> Equal expectation fails at character 0 with [Nov] and [Oct] at line [166]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testthisdaynameshort -> Equal expectation fails at character 0 with [Wed] and [Tue] at line [169]
Fail: Util Tests -> util_textual_test.php -> Test of Calendar_Util_Textual -> testorderedweekdaysshort -> Equal expectation fails with member [0] at character 1 with [Sun] and [Sat] at line [181]

[2005-01-15 22:08 UTC] chris at deskpro dot com

Found the problem. Textual.php uses the strftime() functions. This is based on the standard date/mktime functions so there is a problem when using gmmktime.