ext/Intl: Fix out-of-bounds argument positions in calendar date/time APIs#22044
Open
LamentXU123 wants to merge 1 commit into
Open
ext/Intl: Fix out-of-bounds argument positions in calendar date/time APIs#22044LamentXU123 wants to merge 1 commit into
LamentXU123 wants to merge 1 commit into
Conversation
Member
|
the bug is legit it seems I ll look at it shortly. |
devnexen
approved these changes
May 15, 2026
Member
devnexen
left a comment
There was a problem hiding this comment.
just the PR title misses a space after IntlGregorianCalendar
Contributor
Author
|
Uh after a quick scan I actually doubt that similar issues exists across the intl code base. |
Member
|
this is fine I did not plan to merge before this week end anyway. |
LamentXU123
commented
May 15, 2026
| } | ||
|
|
||
| for (int i = 0; i < arg_num; i++) { | ||
| /* Arguments start at 1 */ |
Contributor
Author
There was a problem hiding this comment.
Here is another similar issue I've find in the code base. This is incorrect position. Can be tested with
<?php
$cal = IntlCalendar::createInstance();
try {
$cal->set(99999999999, 1, 1);
} catch (Throwable $e) {
echo $e->getMessage(), "\n";
}Will return
IntlCalendar::set(): Argument #0 ($year) must be between -2147483648 and 2147483647
But I expected
IntlCalendar::set(): Argument #1 ($year) must be between -2147483648 and 2147483647
This have been added to the original post.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Will result in
Which I expected the last line being
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.
Edited: With further research, IntlCalendar::set also has this problem.
Will return
But I expected