php / php/php-src

Introduce `ReflectionProperty::isUnset()`

Open
#18,620 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Extension: reflection Feature Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

There is a difference between uninitialized and unset property when magic method like __get() is defined. The need of these two states was discussed in #9389.

Currently there is no way to detect if property is just uninitialized or also unset, so from the observable state, it is impossible to tell the property behaviour of a given object.

repro: https://3v4l.org/lDeXi

This is a feature request to add ReflectionProperty::isUnset() method.

An alternative would be to update property_exists() function behaviour - https://www.php.net/manual/en/function.property-exists.php#116824 - which does not account for unset property since it was introduced.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked 3v4l.org reproduction and the existing ReflectionProperty API entry point in php-src. Define the behavior difference between an uninitialized and an unset property, then confirm that ReflectionProperty::isUnset() can expose it without changing the alternative property_exists() behavior.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.