This project is archived and is in readonly mode.

#945 ✓resolved
Hongli Lai

Remove 'Object#send!'

Reported by Hongli Lai | August 31st, 2008 @ 06:25 PM

'Object#send!', as defined in active_support/core_ext/object/misc.rb, was originally added because Ruby 1.9 has such a method as well. Object#send! has been removed from Ruby 1.9 since November 2007.

Furthermore, using 'Object#send!' can break Delegate classes such as Tempfile, though it depends on the load order. Delegate delegates all methods to its underlying object. If Object#send! is defined before Tempfile was defined, then Tempfile will think that its underlying File object has a 'send!' method. Thus, calling Tempfile#send!(:size) will result in Tempfile calling File#send!(:size). File#size doesn't exist, so a crash will occur as a result. What should have happened is that Tempfile#size is called. But since Object#send! was defined before Tempfile was defined, Tempfile (or rather, Delegate) will override 'send!' and replace it with a version that forwards the call to File.

The attached patch removes 'Object#send!'.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages