summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-26 14:30:40 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-26 14:30:40 +0000
commitea2e083a1d67e31b8699aa849f0e1477e6ca4131 (patch)
tree31872b683ab0d3fcd9d73260f8e42af6e8cb99d8 /lib/rexml
parent684ce8403c0738bbada6d84cfe60a6e16824421b (diff)
* lib/rexml/document.rb: move entity_expansion_limit accessor to ...
* lib/rexml/rexml.rb: ... here to make rexml/text independent from REXML::Document. It causes circular require. * lib/rexml/document.rb (REXML::Document.entity_expansion_limit): deprecated. * lib/rexml/document.rb (REXML::Document.entity_expansion_limit=): deprecated. * lib/rexml/text.rb: add missing require "rexml/rexml" for REXML.entity_expansion_limit. Reported by Robert Ulejczyk. Thanks!!! [ruby-core:52895] [Bug #7961] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/document.rb10
-rw-r--r--lib/rexml/rexml.rb12
-rw-r--r--lib/rexml/text.rb3
3 files changed, 20 insertions, 5 deletions
diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb
index 9daa86e..76679d1 100644
--- a/lib/rexml/document.rb
+++ b/lib/rexml/document.rb
@@ -255,16 +255,18 @@ module REXML
return @@entity_expansion_limit
end
- @@entity_expansion_text_limit = 10_240
-
# Set the entity expansion limit. By default the limit is set to 10240.
+ #
+ # Deprecated. Use REXML.entity_expansion_text_limit= instead.
def Document::entity_expansion_text_limit=( val )
- @@entity_expansion_text_limit = val
+ REXML.entity_expansion_text_limit = val
end
# Get the entity expansion limit. By default the limit is set to 10240.
+ #
+ # Deprecated. Use REXML.entity_expansion_text_limit instead.
def Document::entity_expansion_text_limit
- return @@entity_expansion_text_limit
+ return REXML.entity_expansion_text_limit
end
attr_reader :entity_expansion_count
diff --git a/lib/rexml/rexml.rb b/lib/rexml/rexml.rb
index f899511..bc59a30 100644
--- a/lib/rexml/rexml.rb
+++ b/lib/rexml/rexml.rb
@@ -28,4 +28,16 @@ module REXML
Copyright = COPYRIGHT
Version = VERSION
+
+ @@entity_expansion_text_limit = 10_240
+
+ # Set the entity expansion limit. By default the limit is set to 10240.
+ def self.entity_expansion_text_limit=( val )
+ @@entity_expansion_text_limit = val
+ end
+
+ # Get the entity expansion limit. By default the limit is set to 10240.
+ def self.entity_expansion_text_limit
+ return @@entity_expansion_text_limit
+ end
end
diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb
index 878d13b..7b00b0f 100644
--- a/lib/rexml/text.rb
+++ b/lib/rexml/text.rb
@@ -1,3 +1,4 @@
+require 'rexml/rexml'
require 'rexml/entity'
require 'rexml/doctype'
require 'rexml/child'
@@ -383,7 +384,7 @@ module REXML
sum = 0
string.gsub( /\r\n?/, "\n" ).gsub( REFERENCE ) {
s = Text.expand($&, doctype, filter)
- if sum + s.bytesize > Document.entity_expansion_text_limit
+ if sum + s.bytesize > REXML.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += s.bytesize