Skip to content

createElement does not warn about props.__proto__ being null, fails instead #6854

@alitaheri

Description

@alitaheri

This is a bug in React.createElement code:

React.createElement does not warn if props.__proto__ is null ( from Object.create(null) ) since it believes that to be a plain object originating from #6134. But since it directly accesses hasOwnProperty it fails if such object is passed as props.

Reproduce:

const props = Object.create(null);
React.createElement(() => null, props);

What is the expected behavior?
It shouldn't use hasOwnProperty directly on props if such object is expected.

React: 15.1.0
Browsers: All
OS: All

This affects all versions of React but since after 15.1.0 the acceptable shape of props is explicitly defined then it should be explicitly supported as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions