Actions
Bug #3147
closedgsub evaluates the passed in replacement string making results unpredictable when replacement string is dynamically generated
Status:
Rejected
Assignee:
-
ruby -v:
ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-linux]
Description
=begin
after the interpreter evaluates the replacement string (if it's a literal in "" or ''), gsub further evaluates it during execution changing the effective replacement string.
irb(main):016:0> a = 'Y'
=> "Y"
irb(main):017:0> b = 'Z\1'
=> "Z\1"
irb(main):018:0> c = '\\1'
=> "\\1"
irb(main):019:0> a.gsub(/(Y)/, b)
=> "ZY"
irb(main):020:0> a.gsub(/(Y)/, c)
=> "\1"
The last result is expected to be "\Y"
=end
Actions
Like0
Like0Like0Like0Like0