diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-31 00:12:54 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-31 00:12:54 +0000 |
commit | 3cefaf62788ca8eda1747c0db7dfcd350b6978f2 (patch) | |
tree | c127463008225d4f786d70d10fd74d647f72f7d5 | |
parent | cb4feba988ccd3081161f01e417e9cd6785bd133 (diff) |
merges r31744 and r31745 from trunk into ruby_1_9_2.
--
prevent an error when passing a frozen string to REXML::Text.new
dup the string passed in instead of cloning so that it's frozen state is ignored
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org>
--
ChangeLog for it
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | lib/rexml/text.rb | 2 | ||||
-rw-r--r-- | test/rexml/test_core.rb | 3 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 13 insertions, 2 deletions
@@ -1,3 +1,11 @@ +Fri May 27 11:31:51 2011 misfo <tedwardo2@gmail.com> + + * lib/rexml/text.rb (REXML::Text#initialize): prevent an error + when passing a frozen string to REXML::Text.new + + dup the string passed in instead of cloning so that it's frozen + state is ignored + Sun May 22 07:10:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com> * test/openssl/test_pkey_dsa.rb: Add tests for sign/verify. diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb index 05d5341abb..6623c0c03b 100644 --- a/lib/rexml/text.rb +++ b/lib/rexml/text.rb @@ -105,7 +105,7 @@ module REXML @normalized = @unnormalized = nil if arg.kind_of? String - @string = arg.clone + @string = arg.dup @string.squeeze!(" \n\t") unless respect_whitespace elsif arg.kind_of? Text @string = arg.to_s diff --git a/test/rexml/test_core.rb b/test/rexml/test_core.rb index 48a31aee0e..204be0fdff 100644 --- a/test/rexml/test_core.rb +++ b/test/rexml/test_core.rb @@ -371,6 +371,9 @@ class Tester < Test::Unit::TestCase assert_equal(string, text.to_s) text2 = Text.new(text) assert_equal(text, text2) + string = "Frozen".freeze + text3 = Text.new(string) + assert_equal(string, text3.to_s) #testing substitution string = "0 < ( 1 & 1 )" correct = "0 < ( 1 & 1 )" @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 257 +#define RUBY_PATCHLEVEL 258 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |