Skip to content

Prevent instantiation and cloning of __PHP_Incomplete_Class#21325

Open
jordikroon wants to merge 6 commits intophp:masterfrom
jordikroon:incomplete_class-constructor
Open

Prevent instantiation and cloning of __PHP_Incomplete_Class#21325
jordikroon wants to merge 6 commits intophp:masterfrom
jordikroon:incomplete_class-constructor

Conversation

@jordikroon
Copy link
Contributor

@jordikroon jordikroon commented Mar 1, 2026

RFC: https://wiki.php.net/rfc/deprecate-incomplete-class-instantiation

Extending or using newInstanceWithoutConstructor already wasn't possible. This PR extends that by disallowing calling the constructor or cloning __PHP_Incomplete_Class.

There were a few tests relying on new __PHP_Incomplete_Class, those have been updated to reflect the change.

@iluuu1994
Copy link
Member

I believe an RFC discussion is mandatory. I don't necessarily think it's a bad BC break, but the benefit is questionable.

@jordikroon jordikroon force-pushed the incomplete_class-constructor branch from 926b6df to 6ef203a Compare March 2, 2026 11:57
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
@TimWolla TimWolla added the RFC label Mar 3, 2026
@TimWolla
Copy link
Member

TimWolla commented Mar 3, 2026

Given that you created an RFC now, please include a link in the PR description.

@jordikroon
Copy link
Contributor Author

Done. Thank you for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants