php / php/php-src

ext/xml case folding broken for non-ASCII characters

オープン
#12,341 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Extension: xml Status: Verified
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

locale に依存する SKIPIF を含む ext/xml/tests/xml007.phpt から始め、PHP 8.2 以降で失敗を再現します。strtoupper に関連する ext/xml の大文字・小文字変換の動作を追跡し、テストが実行され、非 ASCII 文字に対して locale に依存しない大文字処理が行われることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
internationalization
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。