Skip to content

Commit 99fdf59

Browse files
committed
Fix #52974: jewish.c: compile error under Windows with GBK charset
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.
1 parent 9e54d9d commit 99fdf59

File tree

3 files changed

+82
-25
lines changed

3 files changed

+82
-25
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.1.21
44

5+
- Calendar:
6+
. Fixed bug #52974 (jewish.c: compile error under Windows with GBK charset).
7+
(cmb)
8+
59
- Filter:
610
. Fixed bug #76366 (References in sub-array for filtering breaks the filter).
711
(ZiHang Gao)

ext/calendar/jewish.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -340,38 +340,38 @@ char *JewishMonthName[14] =
340340
char *JewishMonthHebNameLeap[14] =
341341
{
342342
"",
343-
"úùøé",
344-
"çùåï",
345-
"ëñìå",
346-
"èáú",
347-
"ùáè",
348-
"àãø à'",
349-
"àãø á'",
350-
"ðéñï",
351-
"àééø",
352-
"ñéåï",
353-
"úîåæ",
354-
"àá",
355-
"àìåì"
343+
"\xFA\xF9\xF8\xE9",
344+
"\xE7\xF9\xE5\xEF",
345+
"\xEB\xF1\xEC\xE5",
346+
"\xE8\xE1\xFA",
347+
"\xF9\xE1\xE8",
348+
"\xE0\xE3\xF8 \xE0'",
349+
"\xE0\xE3\xF8 \xE1'",
350+
"\xF0\xE9\xF1\xEF",
351+
"\xE0\xE9\xE9\xF8",
352+
"\xF1\xE9\xe5\xEF",
353+
"\xFA\xEE\xE5\xE6",
354+
"\xE0\xE1",
355+
"\xE0\xEC\xE5\xEC"
356356
};
357357

358358
/* names for regular year */
359359
char *JewishMonthHebName[14] =
360360
{
361361
"",
362-
"úùøé",
363-
"çùåï",
364-
"ëñìå",
365-
"èáú",
366-
"ùáè",
362+
"\xFA\xF9\xF8\xE9",
363+
"\xE7\xF9\xE5\xEF",
364+
"\xEB\xF1\xEC\xE5",
365+
"\xE8\xE1\xFA",
366+
"\xF9\xE1\xE8",
367367
"",
368-
"àãø",
369-
"ðéñï",
370-
"àééø",
371-
"ñéåï",
372-
"úîåæ",
373-
"àá",
374-
"àìåì"
368+
"\xE0\xE3\xF8",
369+
"\xF0\xE9\xF1\xEF",
370+
"\xE0\xE9\xE9\xF8",
371+
"\xF1\xE9\xE5\xEF",
372+
"\xFA\xEE\xE5\xE6",
373+
"\xE0\xE1",
374+
"\xE0\xEC\xE5\xEC"
375375
};
376376

377377
/************************************************************************
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--TEST--
2+
Test all hebrew month names
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('calendar')) die('skip calendar extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
for ($year = 5000; $year <= 5001; $year++) {
10+
$leap = ($year === 5001) ? 'leap' : 'normal';
11+
echo "$leap year $year\n";
12+
for ($month = 1; $month <= 13; $month++) {
13+
$jd = jewishtojd($month, 1, $year);
14+
$hebrew = jdtojewish($jd, true);
15+
$hex = bin2hex($hebrew);
16+
echo "$hex\n";
17+
}
18+
echo "\n";
19+
}
20+
?>
21+
===DONE===
22+
--EXPECT--
23+
normal year 5000
24+
e020faf9f8e920e4
25+
e020e7f9e5ef20e4
26+
e020ebf1ece520e4
27+
e020e8e1fa20e4
28+
e020f9e1e820e4
29+
e020e0e3f820e02720e4
30+
e020e0e3f820e12720e4
31+
e020f0e9f1ef20e4
32+
e020e0e9e9f820e4
33+
e020f1e9e5ef20e4
34+
e020faeee5e620e4
35+
e020e0e120e4
36+
e020e0ece5ec20e4
37+
38+
leap year 5001
39+
e020faf9f8e920e4e0
40+
e020e7f9e5ef20e4e0
41+
e020ebf1ece520e4e0
42+
e020e8e1fa20e4e0
43+
e020f9e1e820e4e0
44+
e020e0e3f820e4e0
45+
e020e0e3f820e4e0
46+
e020f0e9f1ef20e4e0
47+
e020e0e9e9f820e4e0
48+
e020f1e9e5ef20e4e0
49+
e020faeee5e620e4e0
50+
e020e0e120e4e0
51+
e020e0ece5ec20e4e0
52+
53+
===DONE===

0 commit comments

Comments
 (0)