Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ PHP NEWS
- Standard:
. Fixed bug GH-22360 (convert.base64-encode corruption on
incremental flush). (David Carlier)
. Fixed bug GH-22395 (base_convert() outputs at most 64 characters).
(Weilin Du)

02 Jul 2026, PHP 8.4.23

Expand Down
3 changes: 2 additions & 1 deletion ext/standard/math.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,6 +24,7 @@
#include "zend_exceptions.h"
#include "zend_multiply.h"
#include "zend_portability.h"
#include "zend_strtod.h"

#include <float.h>
#include <math.h>
Expand DownExpand Up@@ -949,7 +950,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base)
if (Z_TYPE_P(arg) == IS_DOUBLE) {
double fvalue = floor(Z_DVAL_P(arg)); /* floor it just in case */
char *ptr, *end;
char buf[(sizeof(double) << 3) + 1];
char buf[ZEND_DOUBLE_MAX_LENGTH];

/* Don't try to convert +/- infinity */
if (fvalue == ZEND_INFINITY || fvalue == -ZEND_INFINITY) {
Expand Down
11 changes: 11 additions & 0 deletions ext/standard/tests/math/gh22395.phpt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
--TEST--
GH-22395 (base_convert outputs at most 64 characters)
--FILE--
<?php
$result = base_convert(str_repeat("1", 61), 36, 16);
var_dump(strlen($result));
var_dump(substr($result, 0, 13));
?>
--EXPECT--
int(78)
string(13) "4b61b5e0639ff"
Loading