[wp-trac] [WordPress Trac] #58896: Fix WP_List_Table magic methods for PHP 8.2 dynamic properties
WordPress Trac
noreply at wordpress.org
Tue Jul 25 19:37:15 UTC 2023
#58896: Fix WP_List_Table magic methods for PHP 8.2 dynamic properties
--------------------------------------------+-----------------------------
Reporter: antonvlasenko | Owner: hellofromTonya
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.4
Component: Administration | Version: 4.0
Severity: normal | Resolution:
Keywords: php82 has-patch has-unit-tests | Focuses:
--------------------------------------------+-----------------------------
Comment (by hellofromTonya):
== Exploring Option 2
Let's look at option 2, which proposes to make the properties `public` and
remove the magic methods.
=== Scenario 1: Accessing a defined property
Demo code: https://3v4l.org/jNFmL#v8.1.20
* Get: works the same ✅
* `isset()`: works the same ✅
* Set: works the same ✅
* `unset()`: works the same ✅
* After an `unset()`:
* Get: works the same ✅
* `isset()`: works the same ✅
* Set: works the same ✅
Functionality is unaffected
=== Scenario 2: Accessing an undefined (dynamic) property
Demo code: https://3v4l.org/nCACX#v8.1.20
* Get: ❌
* both return same value of `NULL` ✅
* Without magic method: throws `Warning` ❌
* `isset()`: works the same ✅
* Set: ❌
* With magic method: does not set - value remains `NULL`
* Without magic method: value sets ❌
* `unset()`: works the same ✅
* After an `unset()`
* Get: ❌
* both return same value of `NULL` ✅
* Without magic method: throws `Warning` ❌
* `isset()`: works the same ✅
* Set: ❌
* With magic method: does not set - value remains `NULL`
* Without magic method: value sets ❌
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58896#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list