Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different results for to_h and to_hash on ENV #3162

Closed
ghost opened this issue Jul 22, 2015 · 3 comments · Fixed by #3218
Closed

Different results for to_h and to_hash on ENV #3162

ghost opened this issue Jul 22, 2015 · 3 comments · Fixed by #3218

Comments

@ghost
Copy link

ghost commented Jul 22, 2015

Hi,

converting ENV to a Hash gives different results. It depends on which to_-method is used.

MRI

ENV.object_id
# => 17981260
ENV.to_h.object_id
# => 22183040
ENV.to_hash.object_id
# => 22148380

JRuby

ENV.object_id
# => 2042
ENV.to_h.object_id
# => 2042
ENV.to_hash.object_id
# => 2044
@maxmeyer
Copy link

The same is true for jruby 9000.

irb(main):006:0> ENV.object_id
=> 2050
irb(main):007:0> ENV.to_h.object_id
=> 2050
irb(main):008:0> ENV.to_hash.object_id
=> 2052
jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 OpenJDK 64-Bit Server VM 24.85-b03 on 1.7.0_85-b01 +jit [linux-amd64]

reuben-sutton added a commit to reuben-sutton/jruby that referenced this issue Aug 3, 2015
returning the same object to make compatible with MRI

fixes jruby#3162
@maxmeyer
Copy link

maxmeyer commented Aug 6, 2015

Will there be a release for 1.7 and 9000 including the fix?

@kares
Copy link
Member

kares commented Aug 6, 2015

eventually yes but probably no rushing due this, please note that for 1.7.x ENV.to_hash is already working as expected and ENV.to_h should actually not exists (up till Ruby 2.0) ... will be honoured (since 1.7.22)

@kares kares added this to the JRuby 9.0.1.0 milestone Aug 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants