[ruby-dev:50630] [Ruby trunk Bug#15058][Closed] REXML::Text#clone returns a text node with a double escaped Sting
From:
kou@...
Date:
2018-09-02 13:55:14 UTC
List:
ruby-dev #50630
Issue #15058 has been updated by kou (Kouhei Sutou).
Status changed from Open to Closed
Assignee set to kou (Kouhei Sutou)
たしかにその通りですね。
そうなるようにしておきました。
近いうちにこの修正が入ったrexml gemをリリースしておきます。
----------------------------------------
Bug #15058: REXML::Text#clone returns a text node with a double escaped Sting
https://bugs.ruby-lang.org/issues/15058#change-73850
* Author: rna (Ryosuke Nanba)
* Status: Closed
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version:
* ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
`REXML::Text#clone` で生成したオブジェクトが元のオブジェクトと異なる値を持ったテキストノードになります。clone されたテキストノードの `to_s` の値は、元のテキストノードが表現する文字列を二重にエスケープしたものになります。
例:
~~~
require 'rexml/document'
t = REXML::Text.new("< <", false, nil, false)
t2 = t.clone
t.to_s # => "&lt; <"
t2.to_s # => "&amp;lt; &lt; (expected: "&lt; <")
t == t2 # => false (expected: true)
~~~
clone したテキストノードの値は元のテキストノードと同じ値になるべきです。
--
https://bugs.ruby-lang.org/