[php-src] Issue #22256: Change in variable assignment behavior as argument
[email protected] (devsseb) Mon, 8 Jun 2026 09:18:23 +0000
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/22256
Author: devsseb
### Description
The following code:
```php
<?php
$text = 'abc';
$offset = 0;
$char = substr($text, $offset, $offset = strpos($text, 'b', $offset));
var_dump($char);
```
Resulted in this output with PHP 8.2.31 :
```
string(1) "a"
```
Resulted in this output with PHP 8.4.21 :
```
string(1) "b"
```
### PHP Version
```plain
PHP 8.2.31 (cli) (built: May 8 2026 07:20:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.31, Copyright (c) Zend Technologies
with Zend OPcache v8.2.31, Copyright (c), by Zend Technologies
PHP 8.4.21 (cli) (built: May 8 2026 05:56:48) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.21, Copyright (c) Zend Technologies
with Zend OPcache v8.4.21, Copyright (c), by Zend Technologies
```
### Operating System
PHP 8.2.31 : Debian 12.14 - PHP 8.4.21 : Debian 13.5