Bug #67960 [Com]: Long/short day names reversed in jddayofweek()
| From: | fisharebest at gmail dot com | Date: | Thu, 04 Sep 2014 15:29:13 +0000 |
| Subject: | Bug #67960 [Com]: Long/short day names reversed in jddayofweek() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187415@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67960&edit=1
ID: 67960
Comment by: fisharebest at gmail dot com
Reported by: fisharebest at gmail dot com
Summary: Long/short day names reversed in jddayofweek()
Status: Verified
Type: Bug
Package: Calendar related
Operating System: All
PHP Version: 5.6.0
Assigned To: tyrael
Block user comment: N
Private report: N
New Comment:
I think you need to:
1) reverse the order in the enum {} declaration
2) reverse the two labels in the case statement
I have a patch/tests, but can't get the latest code to build so can't test it.
I'll try again tonight when I have access to another dev machine.
Previous Comments:
------------------------------------------------------------------------
[2014-09-04 14:07:09] tyrael@php.net
haha, nice catch, this seems to be wrong since the begining:
http://3v4l.org/OXRAC
the fix should be swapping the lines here:
http://lxr.php.net/xref/PHP_5_6/ext/calendar/calendar.c#699
I suppose this could also go into 5.5 as well.
------------------------------------------------------------------------
[2014-09-04 13:34:07] fisharebest at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.jddayofweek
---
The $mode parameter is an integer (0, 1 or 2) for which
predefined constants are also available.
Numeric parameters work as per the documentation:
0 = numeric
1 = long name
2 = short name
But if the constants CAL_DOW_LONG and CAL_DOW_SHORT are used,
the wrong results are returned. CAL_DOW_LONG gives the short
name and CAL_DOW_SHORT gives the long name.
The bug is present in all versions of PHP from 5.3 through 5.6.
Test script:
---------------
print_r(jddayofweek(1234567, 1)); // "Saturday"
print_r(jddayofweek(1234567, CAL_DOW_LONG)); // "Sat" (WRONG)
print_r(CAL_DOW_LONG); // 2
print_r(jddayofweek(1234567, 2)); // "Sat"
print_r(CAL_DOW_SHORT); // 1
print_r(jddayofweek(1234567, CAL_DOW_SHORT)); // "Saturday" (WRONG)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67960&edit=1