XML::LibXML string parsing mishandles declared encodings

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

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

Start with src/main/java/org/perlonjava/runtime/perlmodule/XMLLibXML.java, especially xmlInputSource(), and trace how string inputs reach the XML parser. Use the reported failures in t/02gateway.t and the fixtures with ISO-8859-1 declarations as evidence; verify declared-encoding strings, decoded character strings, and BOM-marked byte strings against system Perl behavior.

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

説明

area:parser area:unicode bug

Summary

PerlOnJava's bundled XML::LibXML returns incorrect character data when parsing the PagSeguro XML fixtures used by Business::CPI::Gateway::PagSeguro 0.904. The upstream distribution passes all 17 tests under system Perl, but fails 3 assertions under PerlOnJava in t/02gateway.t.

Reproduction evidence

CPAN random tester run 20261106-154847-45334:

  • t/02gateway.t failures: notification for completed transaction, notification for failed transaction, and it parses the file correctly.
  • Notification payer name: PerlOnJava returns Jo\uFFFDo da Silva; expected UTF-8 bytes for João da Silva.
  • Transaction payer name: PerlOnJava returns José Comprador; expected José Comprador, matching the system Perl result for the fixture's declared encoding.
  • System Perl oracle: all 17 tests pass, including t/02gateway.t.

The fixtures declare encoding="ISO-8859-1" while containing UTF-8 byte sequences for the accented names. The parser implementation in src/main/java/org/perlonjava/runtime/perlmodule/XMLLibXML.java sends most string inputs to a StringReader in xmlInputSource(). That character-based path bypasses XML byte decoding according to the declaration. The transaction mismatch directly reflects this; the replacement character in notification parsing also points to byte/character conversion on that path and should be covered while fixing it.

Expected behavior

Match system XML::LibXML behavior for string input carrying an XML encoding declaration, including these upstream cases. Preserve correct behavior for already-decoded character strings and BOM-marked byte strings.

Context

The target distribution is pure Perl and uses XML::LibXML; the failing implementation is PerlOnJava's bundled Java provider. No distribution source or tests were modified during classification.

主要言語
Perl
スター
65
フォーク
8
平均マージ
5時間 57分
マージ済み PR(30日)
177

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fglock/PerlOnJava のほかの issue

fglock/PerlOnJava の issue をすべて見る

似ている issue

Perl の issue をもっと見る

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

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