[php-src] PR #22079: ext/intl: Fix argument position for uninitialized calendar arguments
| From: | LamentXU123 | Date: | Mon, 18 May 2026 10:06:25 +0000 |
| Subject: | [php-src] PR #22079: ext/intl: Fix argument position for uninitialized calendar arguments | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36157@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22079
Author: LamentXU123
Found when looking at the code base.
IntlCalendar::equals(),
IntlCalendar::before(), IntlCalendar::after(), and
IntlCalendar::isEquivalentTo() currently report the second parameter position used by
the procedural API, even when called as methods. That is, the argument position will be error by -1.
```php
<?php
$cal = IntlGregorianCalendar::createFromDate(2024, 0, 1);
$uninit = (new ReflectionClass(IntlGregorianCalendar::class))
->newInstanceWithoutConstructor();
try {
$cal->equals($uninit);
} catch (Error $e) {
echo $e->getMessage(), PHP_EOL;
}
try {
intlcal_equals($cal, $uninit);
} catch (Error $e) {
echo $e->getMessage(), PHP_EOL;
}
```
Resulted in:
```
IntlCalendar::equals(): Argument #2 ($other) is uninitialized
intlcal_equals(): Argument #2 ($other) is uninitialized
```
But I expeected:
```
IntlCalendar::equals(): Argument #1 ($other) is uninitialized
intlcal_equals(): Argument #2 ($other) is uninitialized
```
See https://3v4l.org/tQdYo#v8.4.18
Ah, ideally in the future maybe we can refactor this.