@@ -2861,8 +2861,11 @@ PHP_FUNCTION(array_fill_keys)
28612861#define RANGE_CHECK_DOUBLE_INIT_ARRAY (start , end , _step ) do { \
28622862 double __calc_size = ((start - end) / (_step)) + 1; \
28632863 if (__calc_size >= (double)HT_MAX_SIZE) { \
2864+ double __exceed_by = __calc_size - (double)HT_MAX_SIZE; \
28642865 zend_value_error(\
2865- "The supplied range exceeds the maximum array size: start=%0.1f end=%0.1f step=%0.1f", end, start, (_step)); \
2866+ "The supplied range exceeds the maximum array size by %.1f elements: " \
2867+ "start=%.1f, end=%.1f, step=%.1f. Max size: %.0f", \
2868+ __exceed_by, end, start, (_step), (double)HT_MAX_SIZE); \
28662869 RETURN_THROWS(); \
28672870 } \
28682871 size = (uint32_t)_php_math_round(__calc_size, 0, PHP_ROUND_HALF_UP); \
@@ -2873,8 +2876,12 @@ PHP_FUNCTION(array_fill_keys)
28732876#define RANGE_CHECK_LONG_INIT_ARRAY (start , end , _step ) do { \
28742877 zend_ulong __calc_size = ((zend_ulong) start - end) / (_step); \
28752878 if (__calc_size >= HT_MAX_SIZE - 1) { \
2879+ zend_ulong __excess = __calc_size - (HT_MAX_SIZE - 1); \
28762880 zend_value_error(\
2877- "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT " step=" ZEND_LONG_FMT, end, start, (_step)); \
2881+ "The supplied range exceeds the maximum array size by %lu elements: " \
2882+ "start=" ZEND_LONG_FMT ", end=" ZEND_LONG_FMT ", step=" ZEND_LONG_FMT ". " \
2883+ "Calculated size: %lu, Maximum size: %lu.", \
2884+ __excess, end, start, (_step), __calc_size + 1, HT_MAX_SIZE); \
28782885 RETURN_THROWS(); \
28792886 } \
28802887 size = (uint32_t)(__calc_size + 1); \
0 commit comments