Repository navigation
ext/intl: Reject truncated lengths in UConverter::setSubstChars() - #25708
Conversation
iliaal
left a comment
There was a problem hiding this comment.
Is there a reason to target PHP-8.4 here? GH-22199 targeted master and added an UPGRADING entry for the same length truncation in UConverter::transcode(). This setter also changes some previously successful calls to return false. I’d target master for consistency and reuse php_converter_set_subst_chars() there.
|
|
||
| intl_errors_reset(&objval->error); | ||
|
|
||
| if (UNEXPECTED(chars_len > INT8_MAX)) { |
There was a problem hiding this comment.
With new UConverter('invalid-charset-name', 'UTF-8'), a 128-byte substitution already returns false on PHP-8.4. This early return changes getErrorCode() from U_INVALID_STATE_ERROR to U_ILLEGAL_ARGUMENT_ERROR. Please check the length inside the existing src and dest branches so the uninitialized destination keeps its diagnostic.
There was a problem hiding this comment.
Oh wow good catch ;)
613e0c8 to
a8a5c30
Compare
iliaal
left a comment
There was a problem hiding this comment.
Thanks for the fixes, looks good now
|
Thanks for reviewing. |
should be bool(false), but now the 257 'X's are truncated to 1 'X' so its true 😂
Originally reported by @wwkenwong