Skip to content

Object with prototype of null cannot be displayed using text interpolation #11241

Open
@hezedu

Description

@hezedu

Version

2.6.11

Reproduction link

https://codepen.io/hezedu/pen/GRJYXGR

Steps to reproduce

vue: 2.6.11

vue/dist/vue.runtime.js

Lines 96 to 102 in a59e05c

function toString (val) {
return val == null
? ''
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
? JSON.stringify(val, null, 2)
: String(val)
}

toString(Object.create(null);

Will crash:
TypeError: Cannot convert object to primitive value

What is expected?

TypeError

What is actually happening?

error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions