Skip to content
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

UConverter::transcode() always emits an E_WARNING when an invalid encoding is specified #17469

Open
KidFlo opened this issue Jan 11, 2025 · 4 comments
Assignees

Comments

@KidFlo
Copy link

KidFlo commented Jan 11, 2025

From manual page: https://php.net/uconverter.transcode


The documentation should mention that passing an invalid/unsupported encoding name to this method will result in an E_WARNING being emitted (and no error code defined), regardless of the values set for intl.use_exceptions or intl.error_level.

@Girgias
Copy link
Member

Girgias commented Jan 14, 2025

This seems more like a bug in the intl extension than a documentation issue. So transferring to php/php-src.

@Girgias Girgias transferred this issue from php/doc-en Jan 14, 2025
@Girgias Girgias changed the title UConverter::transcode() behavior when an invalid encoding is specified UConverter::transcode() always emits an E_WARNING when an invalid encoding is specified Jan 14, 2025
@devnexen
Copy link
Member

@Girgias with the following

<?php
UConverter::transcode("\x0a", 'nein!!', 'UTF-8');
UConverter::transcode("\x0a", 'UTF-16BE', 'da!');
?>

I get the E_WARNING

Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in /home/dcarlier/test-intl.php on line 2

Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in /home/dcarlier/test-intl.php on line 3

is there a missing case ?

@Girgias
Copy link
Member

Girgias commented Jan 15, 2025

The issue is that it always emits a warning instead of being silenced/promoted to exception depending on the intl error setting as far as I understand.

@devnexen
Copy link
Member

Ah thanks. will have a look soon-ish.

devnexen added a commit to devnexen/php-src that referenced this issue Jan 16, 2025
Respecting instead intl.use_exceptions/intl.error_level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants