Skip to content
This repository was archived by the owner on Feb 18, 2020. It is now read-only.

Commit fe59c5f

Browse files
CArray_Print wrong offset for inf values.
1 parent dc4caa3 commit fe59c5f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/carray.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,9 @@ _print_recursive(CArray * array, CArrayIterator * iterator, int * index, int cur
11731173
value = (int *) CArrayIterator_DATA(iterator);
11741174
snprintf(tmp_str_num, 11, "%d", *value);
11751175
offset = max_digits - strlen(tmp_str_num);
1176+
if (*value == INFINITY) {
1177+
offset = max_digits - 3;
1178+
}
11761179
for (j = 0; j < offset; j++) {
11771180
php_printf(" ");
11781181
}
@@ -1196,6 +1199,9 @@ _print_recursive(CArray * array, CArrayIterator * iterator, int * index, int cur
11961199
value = (double *) CArrayIterator_DATA(iterator);
11971200
snprintf(tmp_str_num, 320, "%.8f", *value);
11981201
offset = max_digits - strlen(tmp_str_num);
1202+
if (*value == INFINITY) {
1203+
offset = max_digits - 3;
1204+
}
11991205
for (j = 0; j < offset; j++) {
12001206
php_printf(" ");
12011207
}
@@ -1207,6 +1213,9 @@ _print_recursive(CArray * array, CArrayIterator * iterator, int * index, int cur
12071213
value = IT_DDATA(iterator);
12081214
snprintf(tmp_str_num, 320, "%.0f", *value);
12091215
offset = max_digits - strlen(tmp_str_num);
1216+
if (*value == INFINITY) {
1217+
offset = max_digits - 3;
1218+
}
12101219
for (j = 0; j < offset; j++) {
12111220
php_printf(" ");
12121221
}

0 commit comments

Comments
 (0)