|
35 | 35 |
|
36 | 36 | #define COMMON (is_ref ? "&" : "") |
37 | 37 |
|
38 | | -/* Copied from main/spprintf.c and use the same buffer size |
39 | | - * |
40 | | - * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions |
41 | | - * |
42 | | - * XXX: this is a magic number; do not decrease it |
43 | | - * Emax = 1023 |
44 | | - * NDIG = 320 |
45 | | - * NUM_BUF_SIZE >= strlen("-") + Emax + strlrn(".") + NDIG + strlen("E+1023") + 1; |
46 | | - */ |
47 | | -#define NUM_BUF_SIZE 2048 |
48 | | - |
49 | 38 | static void php_array_element_dump(zval *zv, zend_ulong index, zend_string *key, int level) /* {{{ */ |
50 | 39 | { |
51 | 40 | if (key == NULL) { /* numeric key */ |
@@ -447,7 +436,7 @@ static void php_object_element_export(zval *zv, zend_ulong index, zend_string *k |
447 | 436 | PHPAPI void php_var_export_ex(zval *struc, int level, smart_str *buf) /* {{{ */ |
448 | 437 | { |
449 | 438 | HashTable *myht; |
450 | | - char tmp_str[NUM_BUF_SIZE]; |
| 439 | + char tmp_str[PHP_DOUBLE_MAX_LENGTH]; |
451 | 440 | zend_string *ztmp, *ztmp2; |
452 | 441 | zend_ulong index; |
453 | 442 | zend_string *key; |
@@ -853,7 +842,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_ |
853 | 842 | return; |
854 | 843 |
|
855 | 844 | case IS_DOUBLE: { |
856 | | - char tmp_str[NUM_BUF_SIZE]; |
| 845 | + char tmp_str[PHP_DOUBLE_MAX_LENGTH]; |
857 | 846 | smart_str_appendl(buf, "d:", 2); |
858 | 847 | php_gcvt(Z_DVAL_P(struc), (int)PG(serialize_precision), '.', 'E', tmp_str); |
859 | 848 | smart_str_appends(buf, tmp_str); |
|
0 commit comments