[php-src] PR #24215: Fix unpack() offset error naming a nonexistent parameter
| From: | lacatoire | Date: | Fri, 09 Oct 2026 14:06:28 +0000 |
| Subject: | [php-src] PR #24215: Fix unpack() offset error naming a nonexistent parameter | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39282@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24215
Author: lacatoire
The
unpack() error for an out-of-range $offset names a parameter that does
not exist. The signature is unpack(string $format, string $string, int $offset = 0),
and $data was renamed to $string in 25f1c405ff.
```php
try { unpack("N", "abcd", 9); } catch (ValueError $e) { echo
$e->getMessage(); }
```
Before:
```
unpack(): Argument #3 ($offset) must be contained in argument #2 ($data)
```
After:
```
unpack(): Argument #3 ($offset) must be contained in argument #2 ($string)
```
unpack_offset.phpt is updated, and now also lists the parameter names through
Reflection so a future rename cannot leave this message stale. The test passes.