[php-src] Issue #23882: Behavioral change regarding type strictness in PHP 8.6
| From: | jnoordsij | Date: | Thu, 24 Sep 2026 08:35:12 +0000 |
| Subject: | [php-src] Issue #23882: Behavioral change regarding type strictness in PHP 8.6 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252815@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/23882
Author: jnoordsij
### Description
The following code:
```php
<?php declare(strict_types=1);
array_map(trim(...), [1]);
```
Resulted in this output (on PHP 8.6):
```
PHP Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, int
given in /home/jnoordsij/foo.php:3
Stack trace:
#0 /home/jnoordsij/foo.php(3): trim()
#1 {main}
thrown in /home/jnoordsij/foo.php on line 3
```
But I expected this output instead (as it is on PHP 8.5):
```
```
### PHP Version
```plain
PHP 8.6.0beta3 (cli) (built: Sep 23 2026 10:57:45) (NTS)
Copyright © The PHP Group and Contributors
Built by Ubuntu
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
with Xdebug v3.6.0alpha1, Copyright (c) 2002-2026, by Derick Rethans
with Zend OPcache v8.6.0beta3, Copyright ©, by Zend by Perforce
Compared to
PHP 8.5.10 (cli) (built: Aug 28 2026 07:23:25) (NTS)
Copyright (c) The PHP Group
Built by Ubuntu
Zend Engine v4.5.10, Copyright (c) Zend Technologies
with Xdebug v3.5.3, Copyright (c) 2002-2026, by Derick Rethans
with Zend OPcache v8.5.10, Copyright (c), by Zend Technologies
```
### Operating System
Ubuntu 26.04 (wsl)