php / php/php-src

ext/xml case folding broken for non-ASCII characters

未关闭
#12,341 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Extension: xml Status: Verified
主要语言
C
星标
40.4k
派生
8.1k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 ext/xml/tests/xml007.phpt 开始,包括其依赖 locale 的 SKIPIF,并在 PHP 8.2 或更高版本上复现该失败。跟踪与 strtoupper 相关的 ext/xml 大小写转换行为,并验证测试能够运行,且对非 ASCII 字符产生不依赖 locale 的大写处理。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, php
领域
internationalization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。