Typed property /w magic __get cannot be uninitialized
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
demo: https://3v4l.org/lDeXi
Currently, typed property can be "almost uninitialized" by unset().
But doing such uninitialization unsets the property and allows magic __get to kick in. This is expected and discussed in https://github.com/php/php-src/issues/9021.
Because of this, non-readonly typed property cannot be uninitialized properly. This is an issue in cases when the same object is to be restored, reused or cleaned.
To allow an object state to be restored/uninitialized correctly, I propose to add ReflectionProperty::setUninitialized() method and backport it into PHP 8.0 and above.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ReflectionProperty API, the 3v4l demo, and the linked discussion about __get behavior. Determine the compatibility and implementation requirements for a setUninitialized() method, including the requested PHP 8.0-and-above backport; the issue is done when the proposal is implemented and its behavior is covered by the project’s tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100