diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-09-09 10:28:53 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-09 10:38:07 +0200 |
commit | 6e2851d4261fbbea00e8e74802a507a89af80e2f (patch) | |
tree | a7714d521ef3c0a2776d4f0f99e00cdd2c213bf1 /activesupport | |
parent | 1b94d5dc6500a34803fda784d87a361b532b3fb4 (diff) | |
download | rails-6e2851d4261fbbea00e8e74802a507a89af80e2f.tar.gz rails-6e2851d4261fbbea00e8e74802a507a89af80e2f.tar.bz2 rails-6e2851d4261fbbea00e8e74802a507a89af80e2f.zip |
Remove the Version check as it's not always available.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/rexml.rb | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/activesupport/lib/active_support/core_ext/rexml.rb b/activesupport/lib/active_support/core_ext/rexml.rb index af8ce3af47..058295b057 100644 --- a/activesupport/lib/active_support/core_ext/rexml.rb +++ b/activesupport/lib/active_support/core_ext/rexml.rb @@ -5,30 +5,28 @@ require 'rexml/entity' # http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/ # This fix is identical to rexml-expansion-fix version 1.0.1 -unless REXML::VERSION > "3.1.7.2" - module REXML - class Entity < Child - undef_method :unnormalized - def unnormalized - document.record_entity_expansion! if document - v = value() - return nil if v.nil? - @unnormalized = Text::unnormalize(v, parent) - @unnormalized - end +module REXML + class Entity < Child + undef_method :unnormalized + def unnormalized + document.record_entity_expansion! if document + v = value() + return nil if v.nil? + @unnormalized = Text::unnormalize(v, parent) + @unnormalized + end + end + class Document < Element + @@entity_expansion_limit = 10_000 + def self.entity_expansion_limit= val + @@entity_expansion_limit = val end - class Document < Element - @@entity_expansion_limit = 10_000 - def self.entity_expansion_limit= val - @@entity_expansion_limit = val - end - def record_entity_expansion! - @number_of_expansions ||= 0 - @number_of_expansions += 1 - if @number_of_expansions > @@entity_expansion_limit - raise "Number of entity expansions exceeded, processing aborted." - end + def record_entity_expansion! + @number_of_expansions ||= 0 + @number_of_expansions += 1 + if @number_of_expansions > @@entity_expansion_limit + raise "Number of entity expansions exceeded, processing aborted." end end end |