Project

General

Profile

Actions

Bug #38329

closed

Avoid string building with << which breaks with frozen strings

Added by Ewoud Kohl van Wijngaarden 29 days ago. Updated 19 days ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

When dealing with frozen strings, << breaks. Using += unfreezes the string and is thus safer.

[1] pry(main)> msg = 'x'.freeze
=> "x" 
[2] pry(main)> msg.frozen?
=> true
[3] pry(main)> msg << 'y'
FrozenError: can't modify frozen String: "x" (FrozenError)
from (pry):3:in `__pry__'
[4] pry(main)> msg += 'y'
=> "xy" 
[5] pry(main)> msg.frozen?
=> false

Actions #1

Updated by The Foreman Bot 29 days ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ewoud Kohl van Wijngaarden
  • Pull request https://github.com/theforeman/foreman/pull/10502 added
Actions #2

Updated by The Foreman Bot 19 days ago

  • Fixed in Releases 3.15.0 added
Actions #3

Updated by Ewoud Kohl van Wijngaarden 19 days ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF