Skip to content

Update return types of transliterator_get_error_code(), transliterator_get_error_message(), TransLiterator::getErrorCode(), and TransLiterator::getErrorMessage() #18470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,15 @@ PHP 8.5 UPGRADE NOTES
- Intl:
. IntlDateFormatter::setTimeZone()/datefmt_set_timezone()
throws an IntlException on uninitialised classes/clone failures.

. grapheme_extract() properly assigns $next value when skipping over
invalid starting bytes. Previously there were cases where it would
point to the start of the grapheme boundary instead of the end.
. Locale:: methods throw a ValueError when locale inputs contain null
bytes.
. transliterator_get_error_code(), transliterator_get_error_message()
TransLiterator::getErrorCode(), and TransLiterator::getErrorMessage()
have dropped the false from the return type union. Returning false
was actually never possible.

- libxml:
. libxml_set_external_entity_loader() now has a formal return type of true.
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/php_intl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,6 @@ function transliterator_create_inverse(Transliterator $transliterator): ?Transli

function transliterator_transliterate(Transliterator|string $transliterator, string $string, int $start = 0, int $end = -1): string|false {}

function transliterator_get_error_code(Transliterator $transliterator): int|false {}
function transliterator_get_error_code(Transliterator $transliterator): int {}

function transliterator_get_error_message(Transliterator $transliterator): string|false {}
function transliterator_get_error_message(Transliterator $transliterator): string {}
6 changes: 3 additions & 3 deletions ext/intl/php_intl_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ext/intl/transliterator/transliterator.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public function transliterate(string $string, int $start = 0, int $end = -1): st
* @tentative-return-type
* @alias transliterator_get_error_code
*/
public function getErrorCode(): int|false {}
public function getErrorCode(): int {}

/**
* @tentative-return-type
* @alias transliterator_get_error_message
*/
public function getErrorMessage(): string|false {}
public function getErrorMessage(): string {}
}
6 changes: 3 additions & 3 deletions ext/intl/transliterator/transliterator_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions ext/intl/transliterator/transliterator_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,6 @@ PHP_FUNCTION( transliterator_get_error_code )

/* Fetch the object (without resetting its last error code ). */
to = Z_INTL_TRANSLITERATOR_P( object );
if (to == NULL )
RETURN_FALSE;

RETURN_LONG( (zend_long) TRANSLITERATOR_ERROR_CODE( to ) );
}
Expand All @@ -460,8 +458,6 @@ PHP_FUNCTION( transliterator_get_error_message )

/* Fetch the object (without resetting its last error code ). */
to = Z_INTL_TRANSLITERATOR_P( object );
if (to == NULL )
RETURN_FALSE;

/* Return last error message. */
message = intl_error_get_message( TRANSLITERATOR_ERROR_P( to ) );
Expand Down