From: duerst Date: 2021-11-15T00:14:21+00:00 Subject: [ruby-core:106056] [Ruby master Bug#18337] Ruby allows zero-width characters in identifiers Issue #18337 has been reported by duerst (Martin D��rst). ---------------------------------------- Bug #18337: Ruby allows zero-width characters in identifiers https://bugs.ruby-lang.org/issues/18337 * Author: duerst (Martin D��rst) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- Ruby allows zero-width characters in identifiers, which can be shown with the following small test: irb(main):001:0> script = "ab = 20; a\u200Bb = 30; puts ab;" => "ab = 20; a���b = 30; puts ab;" irb(main):002:0> eval(script) 20 => nil The first line creates the script. It contains a zero-width space (ZWSP), but that's not visible in most contexts (see next line). Looking at the script, one expects 30 as an output, but the output is 20 because there are two variables involved, one with a ZWSP and one without. I propose we fix this by disallowing such characters in identifiers. I'll give more details in a followup. -- https://bugs.ruby-lang.org/ Unsubscribe: