Repository navigation
Conversation
transcode() reads the ICONV_IMPL constant and calls iconv(), but composer.json declares no dependency on ext-iconv. Without the extension it threw "Undefined constant ICONV_IMPL". strcmp() and strcasecmp() call transcode() for non-UTF-8 locales. Use mb_convert_encoding() when iconv is not available, and suggest ext-iconv for transliteration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 13, 2026
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.
Summary of Changes
StringHelper::transcode()reads theICONV_IMPLconstant and callsiconv(), butcomposer.jsondeclares no dependency onext-iconv, not even insuggest. On a PHP build without iconv, every call throwsError: Undefined constant "ICONV_IMPL".strcmp()andstrcasecmp()calltranscode()for non-UTF-8 locales, so they fail the same way.transcode()now falls back tomb_convert_encoding()whenICONV_IMPLis not defined.symfony/polyfill-mbstringis already required. The fallback cannot transliterate: characters that the target encoding cannot represent become?instead of an approximation (€→EUR).ext-iconvis added tosuggestfor that reason. With iconv installed, nothing changes.Testing Instructions
The existing
testTranscodestill passes with iconv. The fallback cannot be exercised in the test suite, because iconv is compiled into the PHP builds used here and in CI. It was checked by hand instead:Joomla\Stringnamespace throwsError: Undefined constant. That is what happens toICONV_IMPLwithout the extension.transcode('Åbc Öde €100', 'UTF-8', 'ISO-8859-1')returns"\xC5bc \xD6de ?100".vendor/bin/phpunitis green, phpcs is clean, and PHPStan reports no errors locally. The PHPStan job in CI fails on4.x-devas well (mb_trimand the other PHP 8.4 polyfill functions are not found), and #66 fixes that.Documentation Changes Required
docs/overview.md(still "TODO" on4.x-dev) gets aStringHelper::transcode()section that explains the iconv transliteration and the mbstring fallback.The owner's docs PR #72 says under "Notes on individual methods" that
transcode()needsext-iconv, which is not declared, and raisesError: Undefined constant "ICONV_IMPL"without it. Whichever of the two is merged second must replace that paragraph. #73, #75 and #77 also append sections to thedocs/overview.mdstub, so expect small conflicts there. #77 also adds an entry tosuggestincomposer.json, on a different line, and a trial merge of the two branches combines that cleanly.🤖 Generated with Claude Code