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

util: .inspect() misformats __proto__ property on prototype-less object #3788

Closed
bnoordhuis opened this issue Nov 12, 2015 · 1 comment
Closed
Labels
good first issue Issues that are suitable for first-time contributors. util Issues and PRs related to the built-in util module.

Comments

@bnoordhuis
Copy link
Member

> var o = Object.create(null); o.__proton__ = 42; util.inspect(o)
'{ __proton__: 42 }'  // no brackets

> var o = Object.create(null); o.__proto__ = 42; util.inspect(o)
'{ [__proto__]: 42 }'  // brackets

I speculate arrayToHash() needs to use Object.create(null) for its dictionary object.

@bnoordhuis bnoordhuis added the util Issues and PRs related to the built-in util module. label Nov 12, 2015
@targos targos added the good first issue Issues that are suitable for first-time contributors. label Nov 12, 2015
@JungMinu
Copy link
Member

@bnoordhuis I will handle this 😄

Fishrock123 pushed a commit that referenced this issue Nov 17, 2015
Fixes #3788
`arrayToHash()` needs to use `Object.create(null)` for its dictionary object.

Refs: #3791
PR-URL: #3831
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that are suitable for first-time contributors. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

No branches or pull requests

3 participants