Skip to content

util.inspect can throw when passed a Proxy #18036

@daurnimator

Description

@daurnimator
> console.log(require("util").inspect(new Proxy({}, {"ownKeys": function() {}})))
TypeError: CreateListFromArrayLike called on non-object
    at Function.getOwnPropertySymbols (<anonymous>)
    at formatValue (util.js:422:24)
    at Object.inspect (util.js:298:10)

As util.inspect is used by console.log in a recursive manner, such a proxy object acts as a "poison pill" for printing an object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions