Changes between Initial Version and Version 2 of Ticket #58896
- Timestamp:
- 07/24/2023 09:53:48 PM (17 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #58896
-
Property
Version
changed from
to
4.0
-
Property
Version
changed from
-
Ticket #58896 – Description
initial v2 1 Changes requested are:2 3 1. Change 1: Add a notice to each of the `WP_List_Table` magic methods to alert and inform developers when attempting to get/set/isset/unset a dynamic property.4 5 1 `WP_List_Table` has a list of compatible fields (`compat_fields`), which was introduced at the same time as the magic methods. The fields in `compat_fields` list are then not dynamic properties, as the magic methods properly handle each. But fields not in that list are dynamic properties. 6 2 … … 15 11 When a dynamic property is called on this class, there's no information given to the developer. The notice of `_doing_it_wrong()` will provide the alert to developers to modify their code. 16 12 17 2. Change 2: Add `return null` in `__get()` when attempting to get a dynamic property that is not in the `compat_fields`. 13 Also notice: the `compat_fields` are essentially public properties through the magic methods. 14 15 Thus, there are 2 ways to fix this class to be compatible with PHP 8.2's dynamic properties: 16 17 1. **Option 1**: Fix the magic methods: 18 19 * Change 1: Add a notice or `_doing_it_wrong()` to each magic method, i.e. to alert and inform developers when attempting to get/set/isset/unset a dynamic property. 20 21 * Change 2: Add `return null` in `__get()` when attempting to get a dynamic property that is not in the `compat_fields`. 22 23 2. **Option 2**: Add each `compat_fields` as a `public` property and remove the magic methods. 18 24 19 25 Props to @jrf for identifying the issue.