From da8a6a6594a12fdb2484f917e957378663779de0 Mon Sep 17 00:00:00 2001 From: kosaki Date: Sat, 8 Oct 2011 11:32:06 +0000 Subject: [PATCH] merge revision(s) 33363: * array.c (ary_join_1): should not copy the encoding of non-string element after string element. [ruby-core:39776] [Bug #5379] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ array.c | 1 + test/ruby/test_array.rb | 2 ++ 3 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index a7815825cf..930e8fd35b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 8 07:31:42 2011 Nobuyoshi Nakada + + * array.c (ary_join_1): should not copy the encoding of non-string + element after string element. [ruby-core:39776] [Bug #5379] + Sat Oct 8 06:51:46 2011 Eric Hodel * lib/rubygems: Update to RubyGems 1.8.11. Move Deprecate into the diff --git a/array.c b/array.c index 64b1890ae1..90d129d5ff 100644 --- a/array.c +++ b/array.c @@ -1644,6 +1644,7 @@ ary_join_1(VALUE obj, VALUE ary, VALUE sep, long i, VALUE result, int *first) case T_STRING: str_join: rb_str_buf_append(result, val); + *first = FALSE; break; case T_ARRAY: obj = val; diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 64524768e1..8d25e85d62 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -926,6 +926,8 @@ class TestArray < Test::Unit::TestCase assert_equal(Encoding::US_ASCII, [1, [u]].join.encoding) assert_equal(Encoding::UTF_8, [u, [e]].join.encoding) assert_equal(Encoding::UTF_8, [u, [1]].join.encoding) + bug5379 = '[ruby-core:39776]' + assert_equal(Encoding::UTF_8, [[], u, nil].join.encoding, bug5379) ensure $, = nil end