Skip to content

Integer#to_s, Integer#to_json includes null character(\x00, \u0000) on JRuby 9.3.* #7104

@panda-squareup

Description

@panda-squareup

Environment Information

  • This issue can be reproduced on either jruby-9.3.3.0 or jruby-9.3.2.0
  • This issue can be reproduced on either linux-x86_64 or arm64(Apple Silicon/M1 processor) platform.

Expected Behavior

  • Integer#to_s, Integer#to_json behave the same as CRuby and previous JRuby versions, for example, jruby-9.2.11.1 does not have this issue.

Actual Behavior

  • JRuby 9.3.* adds an unexpected leading null character to certain integers, but not to all.
# irb
jruby-9.3.3.0 :001 > 999_999_999_999_999.to_s # adds an unexpected null character
 => "\x00999999999999999"
jruby-9.3.3.0 :002 > require 'json'
 => true
jruby-9.3.3.0 :003 > 999_999_999_999_999.to_json # adds an unexpected null character
 => "\u0000999999999999999"
jruby-9.3.3.0 :004 > 123_456_789_012_345.to_s # no leading null character
 => "123456789012345" 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions