Sitelet https://web.archive.org/web/20201023140556/https://github.com/nodejs/node/issues/35730
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

Function has non-object prototype 'null' in instanceof check, when I use node but it is fine in Browser #35730

Open
jackIsZlg opened this issue Oct 21, 2020 · 1 comment · May be fixed by #35754
Open
Assignees

Comments

@jackIsZlg
Copy link

@jackIsZlg jackIsZlg commented Oct 21, 2020

Looks like a Node.js bug. Logging an object should never crash. The same works in the browser:

function X () {}
X.prototype = null;
x = {};
x.constructor = X;
console.log(x);

Node.js:

Uncaught TypeError: Function has non-object prototype 'null' in instanceof check
    at Function.[Symbol.hasInstance] (<anonymous>)
    at getConstructorName (internal/util/inspect.js:535:13)
    at formatRaw (internal/util/inspect.js:803:23)
    at formatValue (internal/util/inspect.js:793:10)
    at inspect (internal/util/inspect.js:326:10)
    at formatWithOptionsInternal (internal/util/inspect.js:1994:40)
    at formatWithOptions (internal/util/inspect.js:1878:10)
    at Object.value (internal/console/constructor.js:306:14)
    at Object.log (internal/console/constructor.js:341:61)

Browser:

{constructor: ƒ}

node Verison: v14.14.0

@targos
Copy link
Member

@targos targos commented Oct 21, 2020

@targos targos added the util label Oct 21, 2020
@BridgeAR BridgeAR self-assigned this Oct 21, 2020
baylesa-dev pushed a commit to baylesa-dev/node that referenced this issue Oct 22, 2020
Remove a useless check on Object descriptor. It seems like js browsers engine dont do this check.

Fixes: nodejs#35730
@baylesa-dev baylesa-dev linked a pull request that will close this issue Oct 22, 2020
3 of 3 tasks complete
baylesa-dev pushed a commit to baylesa-dev/node that referenced this issue Oct 22, 2020
Remove a useless check on Object descriptor. It seems like js browsers engine dont do this check.

Fixes: nodejs#35730
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.