com php-src: Fixes #67960 - Long/short day names reversed in jddayofweek(): ext/calendar/calendar.c ext/calendar/tests/jddayofweek.phpt
| From: | Ferenc Kovacs | Date: | Fri, 02 Jan 2015 09:14:12 +0000 |
| Subject: | com php-src: Fixes #67960 - Long/short day names reversed in jddayofweek(): ext/calendar/calendar.c ext/calendar/tests/jddayofweek.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83949@lists.php.net to get a copy of this message | ||
Commit: 244fc1e05367dc7ebdf2db260c8bc8b106563d26
Author: Greg Roach <fisharebest@gmail.com> Thu, 4 Sep 2014 22:29:26 +0100
Committer: Ferenc Kovacs <tyrael@php.net> Fri, 2 Jan 2015 10:14:12 +0100
Parents: 99162b8198b37b5fa434152e472099379bf1f55c
Branches: PHP-5.5
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=244fc1e05367dc7ebdf2db260c8bc8b106563d26
Log:
Fixes #67960 - Long/short day names reversed in jddayofweek()
Bugs:
https://bugs.php.net/67960
Changed paths:
M ext/calendar/calendar.c
M ext/calendar/tests/jddayofweek.phpt
Diff:
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 34b34da..7ef03f0 100644
--- a/ext/calendar/calendar.c
+++ b/ext/calendar/calendar.c
@@ -208,7 +208,7 @@ static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] ==
13)?JewishMonthHebNameLeap:JewishMonthHebName)
/* For jddayofweek */
-enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG };
+enum { CAL_DOW_DAYNO, CAL_DOW_LONG, CAL_DOW_SHORT };
/* For jdmonthname */
enum { CAL_MONTH_GREGORIAN_SHORT, CAL_MONTH_GREGORIAN_LONG,
@@ -696,10 +696,10 @@ PHP_FUNCTION(jddayofweek)
daynames = DayNameShort[day];
switch (mode) {
- case CAL_DOW_SHORT:
+ case CAL_DOW_LONG:
RETURN_STRING(daynamel, 1);
break;
- case CAL_DOW_LONG:
+ case CAL_DOW_SHORT:
RETURN_STRING(daynames, 1);
break;
case CAL_DOW_DAYNO:
diff --git a/ext/calendar/tests/jddayofweek.phpt b/ext/calendar/tests/jddayofweek.phpt
index c33d598..c564780 100644
--- a/ext/calendar/tests/jddayofweek.phpt
+++ b/ext/calendar/tests/jddayofweek.phpt
@@ -6,7 +6,7 @@ jddayofweek()
<?php
foreach (array(2440588, 2452162, 2453926, -1000) as $jd) {
echo "### JD $jd ###\n";
- for ($mode = 0; $mode <= 2; $mode++) {
+ foreach (array(CAL_DOW_DAYNO, CAL_DOW_LONG, CAL_DOW_SHORT) as $mode) {
echo "--- mode $mode ---\n";
for ($offset = 0; $offset <= 7; $offset++) {
echo jddayofweek($jd + $offset, $mode). "\n";