This project is archived and is in readonly mode.
`starts/ends_with?` implementations incompatible with that of ruby 1.8.7
Reported by Mislav | September 14th, 2009 @ 02:57 PM
starts/ends_with?
methods shouldn't cast argument
to string because ruby 1.8.7 doesn't seem to do that. for
example:
"foobar".ends_with?(:bar)
# => true in ActiveSupport implementation, false in ruby 1.8.7
Comments and changes to this ticket
-
Mislav September 14th, 2009 @ 03:01 PM
- Tag changed from 1.8.7, activesupport, string to 1.8.7, activesupport, patch, string
-
CancelProfileIsBroken September 25th, 2009 @ 12:13 PM
- Tag changed from 1.8.7, activesupport, patch, string to 1.8.7, activesupport, bugmash, patch, string
-
Dmitry Maksimov September 26th, 2009 @ 07:36 PM
not reproducible
Tried on Rails 2.3.4 and rails starts/ends_with? methods work such as ruby 1.8.7 start/end_with? methods. -1 the patch is ok, but there is no bug, so there is no need in patch? -
John Pignata September 26th, 2009 @ 09:02 PM
verified the difference in implementations
+1 patch applies cleanly to master
-
Blue Box Chris September 26th, 2009 @ 10:32 PM
-1 Not reproducible
"foobar".ends_with?('bar') => true "foobar".ends_with?(:bar) => true
-
Matías Flores September 27th, 2009 @ 02:41 AM
+1 patch applies cleanly to 2-3-stable but failed in master
verified the difference in behavior Mislav was talking about
Some additional info: when you're confirming this issue be sure to test it with 1.8.6, as in 1.8.7 and above starts_with and ends_with are just aliases of ruby's start_with and end_with.
-
Elad Meidar September 27th, 2009 @ 03:41 AM
+1 verified the bug and the 2-3-stable patch applies cleanly, i've attached a patch for master, note that i didn't credit Mislav.. but only because i have no idea how to do it.
-
sr.iniv.t September 27th, 2009 @ 05:22 AM
In Ruby 1.8.6, there's no Symbol#length apparently (maybe I'm on an older patchlevel?):
ts > ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0] ts > irb irb(main):001:0> :str.length NoMethodError: undefined method `length' for :str:Symbol from (irb):1
-
Mislav October 11th, 2009 @ 10:32 AM
To those who claim they can't reproduce: my ruby version on Snow Leopard is
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
So if you can find another 1.8.7 version where this is not false:
"foobar".end_with(:bar)
Then please report here. Otherwise, this patch is still valid.
Elad: the way of properly crediting people with
git commit
is to either reference metadata from another commit (-c | -C
options) or to use the--author
option. -
Rizwan Reza February 12th, 2010 @ 12:46 PM
- Tag changed from 1.8.7, activesupport, bugmash, patch, string to 1.8.7, activesupport, patch, string
-
Mislav April 16th, 2010 @ 02:13 PM
- Tag changed from 1.8.7, activesupport, patch, string to 1.8.7, 2.3.x, activesupport, patch, string
Rebased the patch to 2-3-stable branch. Version of this patch for master isn't necessary because Rails 3.0 drops Ruby 1.8.6 support.
-
Repository April 16th, 2010 @ 07:23 PM
- State changed from new to committed
(from [c519215aa83b041d438772977f962f54fff81a83]) ruby 1.8.7 compat:
starts/ends_with?
doesn't cast to stringstarts/ends_with?
methods shouldn't cast argument to string because ruby 1.8.7 doesn't seem to do that. for example:"foobar".ends_with?(:bar) # => true in ActiveSupport implementation, false in ruby 1.8.7
[#3199 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/c519215aa83b041d438772977f962f...
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
Tags
Referenced by
- 3199 `starts/ends_with?` implementations incompatible with that of ruby 1.8.7 [#3199 state:committed]