From: ko1@atdot.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:94340] [Ruby master Bug#11718] Constant access on `nil`
Date: Wed, 14 Aug 2019 06:35:58 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-80739.20190814063557.c3a325fb23ef1f57@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11718.20151120023829@ruby-lang.org
Issue #11718 has been updated by ko1 (Koichi Sasada).
:+1: great patch! could you commit it?
----------------------------------------
Bug #11718: Constant access on `nil`
https://bugs.ruby-lang.org/issues/11718#change-80739
* Author: vais (Vais Salikhov)
* Status: Open
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Target version:
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
It is possible to access top-level constants by doing `nil::CONSTANT`, which looks like a bug [according to Matz](https://github.com/opal/opal/issues/1197#issuecomment-158078778). Here are a couple of examples:
```
$ ruby -ve "Foo = 123; p nil::Foo"
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
123
```
```
$ ruby -ve "class A; Foo = 456; end; p nil::A::Foo"
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
456
```
Thanks!
---Files--------------------------------
nil-const-access-11718.patch (5.32 KB)
--
https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2019-08-14 6:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-11718.20151120023829@ruby-lang.org>
2015-11-20 2:38 ` [ruby-core:71598] [Ruby trunk - Bug #11718] [Open] Constant access on `nil` vsalikhov
2015-11-20 6:25 ` [ruby-core:71600] [Ruby trunk - Bug #11718] " hanmac
2015-11-20 9:18 ` [ruby-core:71605] " eregontp
2015-11-20 9:45 ` [ruby-core:71606] " hanmac
2015-11-23 14:25 ` [ruby-core:71640] " elia
2015-11-23 14:40 ` [ruby-core:71641] " eregontp
2015-11-24 9:23 ` [ruby-core:71649] " ko1
2015-12-07 7:57 ` [ruby-core:71894] " ko1
2015-12-07 10:51 ` [ruby-core:71900] " ko1
2015-12-08 6:41 ` [ruby-core:71940] " hanmac
2019-08-14 5:51 ` [ruby-core:94338] [Ruby master Bug#11718] " merch-redmine
2019-08-14 6:35 ` ko1 [this message]
2019-08-14 7:19 ` [ruby-core:94344] " nobu
2019-08-14 16:08 ` [ruby-core:94352] " merch-redmine
2019-08-14 18:03 ` [ruby-core:94353] " ko1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-80739.20190814063557.c3a325fb23ef1f57@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).