Skip to content

Commit 9f83543

Browse files
committed
Fix bug #65106: PHP fails to compile ext/fileinfo
Make data_file.c's generator output its array initialization "by string", instead of "by list": that makes the compiler happier.
1 parent 927cdd0 commit 9f83543

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ext/fileinfo/create_data_file.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
$dta_l = strlen($dta);
77
$j = 0;
88

9-
echo "const unsigned char php_magic_database[$dta_l] = {\n";
9+
echo "const unsigned char php_magic_database[$dta_l] =\n";
1010
for ($i = 0; $i < $dta_l; $i++) {
11-
printf("0x%02X, ", ord($dta[$i]));
11+
if ($j % 16 == 0) {
12+
echo '"';
13+
}
14+
printf("\\x%02X", ord($dta[$i]));
1215
if ($j % 16 == 15) {
13-
echo "\n";
16+
echo "\"\n";
1417
}
1518
$j++;
1619
}
17-
echo "};\n";
20+
if ($j % 16 > 0) {
21+
echo '"';
22+
}
23+
echo ";\n";
1824
?>

0 commit comments

Comments
 (0)