Skip to content

Commit

Permalink
Fix #52974: jewish.c: compile error under Windows with GBK charset
Browse files Browse the repository at this point in the history
jewish.c includes ISO-8859-8 encoded Hebrew Hebrew month names, which
may cause compile errors, and is generally confusing.  We replace the
literal month names with appropriate escape sequences.
  • Loading branch information
cmb69 committed Jul 22, 2018
1 parent 9e54d9d commit 99fdf59
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 25 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.1.21

- Calendar:
. Fixed bug #52974 (jewish.c: compile error under Windows with GBK charset).
(cmb)

- Filter:
. Fixed bug #76366 (References in sub-array for filtering breaks the filter).
(ZiHang Gao)
Expand Down
50 changes: 25 additions & 25 deletions ext/calendar/jewish.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,38 +340,38 @@ char *JewishMonthName[14] =
char *JewishMonthHebNameLeap[14] =
{
"",
"úùøé",
"çùåï",
"ëñìå",
"èáú",
"ùáè",
"àãø à'",
"àãø á'",
"ðéñï",
"àééø",
"ñéåï",
"úîåæ",
"àá",
"àìåì"
"\xFA\xF9\xF8\xE9",
"\xE7\xF9\xE5\xEF",
"\xEB\xF1\xEC\xE5",
"\xE8\xE1\xFA",
"\xF9\xE1\xE8",
"\xE0\xE3\xF8 \xE0'",
"\xE0\xE3\xF8 \xE1'",
"\xF0\xE9\xF1\xEF",
"\xE0\xE9\xE9\xF8",
"\xF1\xE9\xe5\xEF",
"\xFA\xEE\xE5\xE6",
"\xE0\xE1",
"\xE0\xEC\xE5\xEC"
};

/* names for regular year */
char *JewishMonthHebName[14] =
{
"",
"úùøé",
"çùåï",
"ëñìå",
"èáú",
"ùáè",
"\xFA\xF9\xF8\xE9",
"\xE7\xF9\xE5\xEF",
"\xEB\xF1\xEC\xE5",
"\xE8\xE1\xFA",
"\xF9\xE1\xE8",
"",
"àãø",
"ðéñï",
"àééø",
"ñéåï",
"úîåæ",
"àá",
"àìåì"
"\xE0\xE3\xF8",
"\xF0\xE9\xF1\xEF",
"\xE0\xE9\xE9\xF8",
"\xF1\xE9\xE5\xEF",
"\xFA\xEE\xE5\xE6",
"\xE0\xE1",
"\xE0\xEC\xE5\xEC"
};

/************************************************************************
Expand Down
53 changes: 53 additions & 0 deletions ext/calendar/tests/jdtojewish_hebrew.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
--TEST--
Test all hebrew month names
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip calendar extension not available');
?>
--FILE--
<?php
for ($year = 5000; $year <= 5001; $year++) {
$leap = ($year === 5001) ? 'leap' : 'normal';
echo "$leap year $year\n";
for ($month = 1; $month <= 13; $month++) {
$jd = jewishtojd($month, 1, $year);
$hebrew = jdtojewish($jd, true);
$hex = bin2hex($hebrew);
echo "$hex\n";
}
echo "\n";
}
?>
===DONE===
--EXPECT--
normal year 5000
e020faf9f8e920e4
e020e7f9e5ef20e4
e020ebf1ece520e4
e020e8e1fa20e4
e020f9e1e820e4
e020e0e3f820e02720e4
e020e0e3f820e12720e4
e020f0e9f1ef20e4
e020e0e9e9f820e4
e020f1e9e5ef20e4
e020faeee5e620e4
e020e0e120e4
e020e0ece5ec20e4

leap year 5001
e020faf9f8e920e4e0
e020e7f9e5ef20e4e0
e020ebf1ece520e4e0
e020e8e1fa20e4e0
e020f9e1e820e4e0
e020e0e3f820e4e0
e020e0e3f820e4e0
e020f0e9f1ef20e4e0
e020e0e9e9f820e4e0
e020f1e9e5ef20e4e0
e020faeee5e620e4e0
e020e0e120e4e0
e020e0ece5ec20e4e0

===DONE===

0 comments on commit 99fdf59

Please sign in to comment.