[php-src] PR #22044: ext/Intl: Fix out-of-bounds argument positions for IntlGregorianCalendardate/time construction
| From: | LamentXU123 | Date: | Fri, 15 May 2026 08:43:05 +0000 |
| Subject: | [php-src] PR #22044: ext/Intl: Fix out-of-bounds argument positions for IntlGregorianCalendardate/time construction | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36127@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22044
Author: LamentXU123
When I was looking at the new deprecation of IntlGregorianCalendar::__construct() with more than 2
arguments is deprecated, I find that the argument position in the overflow error is actually wrong.
That is
```php
<?php
try {
new IntlGregorianCalendar(99999999999, 1, 1);
} catch (Throwable $e) {
echo $e->getMessage(), "\n";
}
```
Will result in
```
Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated,
use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime()
instead in /in/dB6p5 on line 3
IntlGregorianCalendar::__construct(): Argument #-1 must be between -2147483648 and 2147483647
```
Which I expected the last line being
```
IntlGregorianCalendar::__construct(): Argument #0 must be between -2147483648 and 2147483647
```
Seems like in the case we don't need to use hasThis() because $this is impossible to exist.
Just using i+1 here will be safe enough.