From: "alindeman (Andy Lindeman)" Date: 2012-12-03T06:00:36+09:00 Subject: [ruby-core:50489] [ruby-trunk - Bug #7499][Open] public_send can be used to invoke protected methods Issue #7499 has been reported by alindeman (Andy Lindeman). ---------------------------------------- Bug #7499: public_send can be used to invoke protected methods https://bugs.ruby-lang.org/issues/7499 Author: alindeman (Andy Lindeman) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0dev (2012-12-03) [x86_64-darwin12.2.1] class Foo def bar "wtf?" end protected :bar def invoke_bar public_send(:bar) end end puts Foo.public_send(:bar) rescue puts "error; this seems normal" puts Foo.new.invoke_bar # The last statement outputs "wtf?" on: # * 1.9.3p194 # * 1.9.3p327 # * ruby-head (2012-12-03) # The last statement raises a NoMethodError on: # * JRuby 1.7.0 # * rubinius 2.0.0dev 2279857e # # I /expected/ the NoMethodError behavior -- http://bugs.ruby-lang.org/