Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Account for two different REXML::Version/VERSION constants in version…

… check
  • Loading branch information...
commit 0861772fd16183058777c6d290cfe25da54e6472 1 parent ef3ac6e
@dhh dhh authored
Showing with 13 additions and 16 deletions.
  1. +13 −16 activesupport/lib/active_support/core_ext/rexml.rb
View
29 activesupport/lib/active_support/core_ext/rexml.rb
@@ -5,21 +5,18 @@
# 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
-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
+# Earlier versions of rexml defined REXML::Version, newer ones REXML::VERSION
+unless (defined?(REXML::VERSION) ? REXML::VERSION : 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
end
def record_entity_expansion!
@@ -30,4 +27,4 @@ def record_entity_expansion!
end
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.