Project

General

Profile

Actions

Bug #21757

open

Splatted args array is mutated when passing unexpected kwargs

Bug #21757: Splatted args array is mutated when passing unexpected kwargs

Added by apotonick (Nick Sutterer) about 3 hours ago. Updated about 3 hours ago.

Status:
Open
Target version:
-
ruby -v:
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]
[ruby-core:123980]

Description

The bug is very simple to provoke.

proc = ->(*) { } # we do NOT expect any keyword arguments.

args = [1, 2]

proc.(*args, bug: true)

pp args #=> [1, 2, {bug: true}]

The args array now has a third element which is exactly what got passed as keyword arguments. This is only in Ruby 3.4, 3.3 and below discard the "unexpected" keyword arguments as expected.

Actions

Also available in: PDF Atom