rfc:undefined_property_error_promotion
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:undefined_property_error_promotion [2022/04/05 00:02] – marandall | rfc:undefined_property_error_promotion [2022/05/06 18:22] (current) – marandall | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Undefined Property Error Promotion ====== | ====== PHP RFC: Undefined Property Error Promotion ====== | ||
- | * Version: | + | * Version: |
- | * Date: 2023-04-04 | + | * Date: 2022-04-04 |
- | * Author: Mark Randall, marandall@php.com | + | * Author: Mark Randall, marandall@php.net |
- | * Status: | + | * Status: |
===== Introduction ===== | ===== Introduction ===== | ||
- | Undefined properties are those that have not yet been defined either by the presence of a property declaration, | + | Undefined properties are those that have not yet been defined either by the presence of a property declaration, |
Undefined properties previously triggered an E_NOTICE, however this was upgraded to E_WARNING as part of the PHP 8.0 Engine Warnings RFC: https:// | Undefined properties previously triggered an E_NOTICE, however this was upgraded to E_WARNING as part of the PHP 8.0 Engine Warnings RFC: https:// | ||
Line 16: | Line 16: | ||
isset / empty / null coalesce DO account for undefined properties and as such are not covered by this RFC. | isset / empty / null coalesce DO account for undefined properties and as such are not covered by this RFC. | ||
+ | |||
+ | The presence of magical `get` will continue to work as it does now, and unknown properties will route to the magical `get` handler rather than cause an error (unless called within `get` on itself). | ||
===== Considerations ===== | ===== Considerations ===== | ||
Line 52: | Line 54: | ||
</ | </ | ||
- | There are several options to discuss: | + | To provide |
- | + | ||
- | - Leave undefined properties as they are | + | |
- | - Throw for accessing any undefined property except for stdClass | + | |
- | - Throw for accessing any undefined property. | + | |
- | + | ||
- | Of these, the option with the most consistency is throwing for accessing any undefined property, including | + | |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | Accessing an undefined property will result in an Error exception being thrown. | + | Accessing an undefined property |
Line 71: | Line 67: | ||
A minor change will be included in the next minor version to alter the existing warning message to indicate the warning will become an error in 9.0. | A minor change will be included in the next minor version to alter the existing warning message to indicate the warning will become an error in 9.0. | ||
- | ===== Proposed | + | ===== Voting ===== |
- | Include these so readers know where you are heading and can discuss the proposed | + | |
+ | Voted started on 2022-04-22, ending 2022-05-05 | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | Meta vote: | ||
+ | |||
+ | <doodle title=" | ||
+ | * Backwards compatibility breaks | ||
+ | * Would be in favour, but not in 9.0 | ||
+ | * Do not like stdClass behaviour | ||
+ | * Something else | ||
+ | </ | ||
rfc/undefined_property_error_promotion.txt · Last modified: 2022/05/06 18:22 by marandall