| 10 | | === Identify all of the known, named dynamic properties Core adds and uses |
| | 10 | |
| | 11 | == Mitigation Approaches |
| | 12 | |
| | 13 | This ticket offers 2 different approaches. It uses the epic ticket #56034 as the guide for mitigation. |
| | 14 | |
| | 15 | === **Approach 1: Declare Core's known, named and deprecate dynamic properties.** |
| | 16 | |
| | 17 | Per #56034: |
| | 18 | >Situation: Known, named, dynamic property |
| | 19 | >Resolution: Declare the property on the (parent) class |
| | 20 | |
| | 21 | This approach proposes to: |
| | 22 | * Soft remove support of dynamic properties by deprecating getting dynamic properties. |
| | 23 | * Identify and declare all of Core's known, named dynamic properties on the `WP_Term` class. |
| | 24 | |
| | 25 | Goals: |
| | 26 | * Remove Core's dynamic properties. |
| | 27 | * Alert extenders via deprecation notice and dev note. |
| | 28 | * Extenders to remove their `WP_Term` dynamic properties and replace with a different custom handling approach. (Note: need to figure out what to recommend to extenders for this migration process.) |
| | 29 | |
| | 30 | Tasks: |
| | 31 | |
| | 32 | 1. Identify all of the known, named dynamic properties Core adds and uses. |
| | 50 | === **Approach 2: Add full support for dynamic properties on `WP_Term`**. |
| | 51 | |
| | 52 | Per #56034: |
| | 53 | >Situation: Known use of unknown dynamic properties |
| | 54 | >Solution: Declare the full set of magic methods on a class |
| | 55 | >... |
| | 56 | >If the class really ''**should**'' support dynamic properties, the magic methods should be implemented on the class itself (or its parent). |
| | 57 | |
| | 58 | This approach proposes to: |
| | 59 | * Fully support dynamic properties on `WP_Term`. |
| | 60 | * Add a full set of magic methods on the `WP_Term` class. |
| | 61 | |
| | 62 | What if extenders are also adding and using dynamic properties? |
| | 63 | It's been possible since WP_Term was introduced in 2015 in WP 4.4.0 via [34997]. |
| | 64 | |
| | 65 | Has it been supported since introduction? |
| | 66 | Yes, as Core itself needed it supported. |
| | 67 | |
| | 68 | Since its introduction, this class has supported and actively added / used dynamic properties. Core itself active uses and adds dynamic properties to `WP_Term` objects. Following its example, extenders also add dynamic properties. |
| | 69 | |
| | 70 | With `WP_Term` being marked as `final`, there's not a way for extenders to declare their dynamic property needs on a custom child class. |
| | 71 | |
| | 72 | It's reasonable to determine that `WP_Term` should fully support dynamic properties. Doing so maintains backward compatibility (BC) with the (hopefully) the lowest risks of breaking things for users. |
| | 73 | |