[php-src] Issue #22395: base_convert outputs at most 64 characters

[email protected] (Sjord) Mon, 22 Jun 2026 12:33:22 +0000
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/22395
Author: Sjord

### Description

The following code:

```php
<?php
var_dump(base_convert("1111111111111111111111111111111111111111111111111111111111111", 36, 16));
```

Resulted in this output:
```
string(64) "0000000000000000000000000000000000000000000000000000000000000000"
```

But I expected this output instead:
```
string(78) "4b61b5e0639ff90000000000000000000000000000000000000000000000000000000000000000"
```

This is likely a regression due to [Rework some string-to-number and vice-versa functions to work smarter ยท php/php-src@f45555e](https://github.com/php/php-src/commit/f45555e62f578854b5862e6a3b84c0a21a053850) from 2001.

Relevant code is [_php_math_zvaltobase in ext/standard/math.c](https://github.com/php/php-src/blob/master/ext/standard/math.c#L1004-L1018).

### PHP Version

```plain
PHP 8.5.4 (cli) (built: May 25 2026 12:19:37) (NTS)
Copyright (c) The PHP Group
Built by Ubuntu
Zend Engine v4.5.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.4, Copyright (c), by Zend Technologies
```

### Operating System

Linux php 7.0.0-22-generic #22-Ubuntu SMP PREEMPT_DYNAMIC Mon May 25 15:37:49 UTC 2026 aarch64 GNU/Linux