summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-06 17:09:29 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-06 17:09:29 +0000
commit68ef195cdfc780a454ef879942c9e97f609ed6e3 (patch)
tree5298774ddd90103d4060c4a26a2642ccfe01f209
parenta2a9858b98e2726a28ff96fba4e3501d2268955b (diff)
* lib/rexml/entity.rb (unnormalized): do not call
document.record_entity_expansion if document is nil. see <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502535>. Thanks, Naohisa Goto. backported from trunk. * test/rexml/test_document.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--lib/rexml/entity.rb2
-rw-r--r--test/rexml/test_document.rb3
3 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d99859d64..794d2aa0c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri Nov 7 02:08:04 2008 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/rexml/entity.rb (unnormalized): do not call
+ document.record_entity_expansion if document is nil.
+ see <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502535>.
+ Thanks, Naohisa Goto. backported from trunk.
+
+ * test/rexml/test_document.rb: ditto.
+
Tue Nov 4 03:28:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* array.c (rb_ary_join): do not repeat self in a recursive array.
diff --git a/lib/rexml/entity.rb b/lib/rexml/entity.rb
index 94e6d3ff1b..7e9b4e5e1a 100644
--- a/lib/rexml/entity.rb
+++ b/lib/rexml/entity.rb
@@ -73,7 +73,7 @@ module REXML
# all entities -- both %ent; and &ent; entities. This differs from
# +value()+ in that +value+ only replaces %ent; entities.
def unnormalized
- document.record_entity_expansion
+ document.record_entity_expansion unless document.nil?
v = value()
return nil if v.nil?
@unnormalized = Text::unnormalize(v, parent)
diff --git a/test/rexml/test_document.rb b/test/rexml/test_document.rb
index 5207b42d72..0261e80b74 100644
--- a/test/rexml/test_document.rb
+++ b/test/rexml/test_document.rb
@@ -35,6 +35,7 @@ EOF
<member>
&a;
&a2;
+&lt;
</member>
EOF
@@ -53,7 +54,7 @@ EOF
REXML::Document.entity_expansion_limit = 4
doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION)
- assert_equal("\na\na a\n", doc.root.children.first.value)
+ assert_equal("\na\na a\n<\n", doc.root.children.first.value)
REXML::Document.entity_expansion_limit = 3
doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION)
assert_raise(RuntimeError) do