Skip to content

ext/iconv/tests/bug48147.phpt: whitelist iconvs with //IGNORE#22552

Merged
Girgias merged 1 commit into
php:PHP-8.4from
orlitzky:blacklist-iconv-ignore
Jul 8, 2026
Merged

ext/iconv/tests/bug48147.phpt: whitelist iconvs with //IGNORE#22552
Girgias merged 1 commit into
php:PHP-8.4from
orlitzky:blacklist-iconv-ignore

Conversation

@orlitzky

@orlitzky orlitzky commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fix the last failure in #22413

PHP has ICONV_BROKEN_IGNORE for implementations (glibc) that return an EILSEQ when they //IGNORE an invalid sequence, but some implementations (musl) don't support //IGNORE at all, and this is allowed by a careful reading of the iconv_open() docs.

Whatever libc does ultimately has to be OK. I think this needs better documentation (php/doc-en#5646) rather than more code.

@orlitzky orlitzky force-pushed the blacklist-iconv-ignore branch from 1b923cc to 58b5bdd Compare July 6, 2026 13:20
@orlitzky orlitzky changed the title ext/iconv/tests/bug48147.phpt: blacklist unknown iconv ext/iconv/tests/bug48147.phpt: whitelist iconvs with //IGNORE Jul 6, 2026
@orlitzky

orlitzky commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Force push / edit: I have been working on a test suite for iconv's POSIX conformance, and it has clarified my thinking. Regardless of what POSIX says about iconv(), the spec for iconv_open() implies that //IGNORE may not be supported at all, since iconv_open() should return EINVAL when it sees an unsupported suffix.

This doesn't meaningfully change anything, but I have updated the commit message and docs with a better explanation of the situation, and have switched the SKIPIF from a blacklist to a whitelist to reflect that //IGNORE support is optional.

This test fails on musl, where iconv trips over the //IGNORE suffix.
It is not obvious that //IGNORE is required to trigger the issue in
the first place, but since we are ensuring that a security bug is
fixed, it is better to include it where possible.

This commit updates the test to append //IGNORE only on the two GNU
iconv implementations that are known to support it. POSIX specifies
its behavior, but leaves overall support optional.
@orlitzky orlitzky force-pushed the blacklist-iconv-ignore branch from 58b5bdd to 8277a9e Compare July 6, 2026 13:41
@Girgias Girgias merged commit 0b96441 into php:PHP-8.4 Jul 8, 2026
18 checks passed
Girgias added a commit that referenced this pull request Jul 8, 2026
* PHP-8.5:
  ext/iconv/tests/bug52211.phpt: use per-iconv charset names (#22543)
  ext/iconv/tests/bug76249.phpt: fallback for non-GNU iconv() (#22552)
pull Bot pushed a commit to wsnchristopher/php-src that referenced this pull request Jul 8, 2026
* PHP-8.4:
  ext/iconv/tests/bug52211.phpt: use per-iconv charset names (php#22543)
  ext/iconv/tests/bug76249.phpt: fallback for non-GNU iconv() (php#22552)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants