ext/xml case folding broken for non-ASCII characters
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
See ext/xml/tests/xml007.phpt
The code will never run in 8.2 or up because of changes to how strtoupper works. This means the test will be skipped due to the SKIPIF settings which has a locale-dependent strtoupper check.
Removing the SKIPIF shows that the test is indeed broken, even on systems where it worked on 8.1 it won't work on 8.2.
Other than that, this never worked properly because it depends on the locale.
From https://www.w3.org/TR/WD-xml-970807.xml
case-folding: a process applied to a sequence of characters, in which those identified as non-uppercase (in scripts which have case distinctions) are replaced by their uppercase equivalents, as specified in The Unicode Standard, Version 2.0, section 4.1. Note that Unicode recommends folding to lowercase; for compatibility reasons, XML processors must fold to uppercase. Case-folding, as described here, neither requires nor forbids the normalization of Unicode character sequences into canonical form (e.g. as described in The Unicode Standard, section 5.9).
So it's not supposed to depend on the locale.
PHP Version
8.1 / 8.2 depending on your point of view
Operating System
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ext/xml/tests/xml007.phpt, including its locale-dependent SKIPIF, and reproduce the failure on PHP 8.2 or newer. Trace the ext/xml case-folding behavior related to strtoupper and verify that the test runs and produces locale-independent uppercase handling for non-ASCII characters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- internationalization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100