]> granicus.if.org Git - php/commitdiff
Fixes #67960 - Long/short day names reversed in jddayofweek()
authorGreg Roach <fisharebest@gmail.com>
Thu, 4 Sep 2014 21:29:26 +0000 (22:29 +0100)
committerFerenc Kovacs <tyrael@php.net>
Fri, 2 Jan 2015 09:14:12 +0000 (10:14 +0100)
ext/calendar/calendar.c
ext/calendar/tests/jddayofweek.phpt

index 34b34da371d01bfff0c0fdfd705e04a2680989b6..7ef03f060f2e519748cc0bb7429e87d2fd346a66 100644 (file)
@@ -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:
index c33d59892d1dd6188a8213090feff52d4be51c21..c5647804bbf3dc1fbc0cabe810c1e41570c557ab 100644 (file)
@@ -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";