Skip to content

Error on writing const object property in 8.2 #11781

Closed as not planned
Closed as not planned
@MaxD2

Description

@MaxD2

Description

The following code:

<?php

class Test {
    public int $x;
}

const test = new Test();

test->x = 1;

Resulted in this output:
Fatal error: Cannot use temporary expression in write context

https://3v4l.org/BmtTZ

PHP Version

PHP 8.1 - 8.2

Operating System

No response

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