[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 21:53:29 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):
Comparing the how the code worked in 3.1 to the changes made in 4.0+, the
BC break happened when the magic methods were added. Removing the magic
methods (option 2) restores the code to how it originally functioned, thus
removing the BC break(s) that happened long ago. Hmm interesting.
Let's compare:
Demo: https://3v4l.org/DZnjf#v8.1.20
* Get:
* Defined property:
* WP 3.1: returns `NULL`
* Current: returns `NULL` ✅
* Option 2: returns `NULL` ✅
* Dynamic property:
* WP 3.1: returned `NULL` and throws `Warning`
* Current: returns `NULL` ❌ 👈 BC Break
* WP 3.1: returned `NULL` and throws `Warning` ✅
* `isset()`:
* Defined property:
* WP 3.1: `false`
* Current: `false` ✅
* Option 2: `false` ✅
* Dynamic property:
* WP 3.1: `false`
* Current: `false` ✅
* Option 2: `false` ✅
* set:
* Defined property:
* WP 3.1: sets
* Current: sets ✅
* Option 2: sets ✅
* Dynamic property:
* WP 3.1: sets
* Current: does not set ❌ 👈 BC Break
* Option 2: sets ✅
* `unset()`:
* Get:
* Defined property:
* WP 3.1: returns `NULL` and throws `Warning`
* Current: returns `NULL` and throws `Warning` ✅
* Option 2: returns `NULL` and throws `Warning` ✅
* Dynamic property:
* WP 3.1: returns `NULL` and throws `Warning`
* Current: returns `NULL` but does not throw `Warning` ❌ 👈 BC
Break
* Option 2: returns `NULL` and throws `Warning` ✅
* `isset()`:
* Defined property:
* WP 3.1: `false`
* Current: `false` ✅
* Option 2: `false` ✅
* Dynamic property:
* WP 3.1: `false`
* Current: `false` ✅
* Option 2: `false` ✅
* Set:
* Defined property:
* WP 3.1: sets
* Current: sets ✅
* Option 2: sets ✅
* Dynamic property:
* WP 3.1: sets
* Current: does not set ❌ 👈 BC Break
* Option 2: sets ✅
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58896#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list