Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #58087, comment 4


Ignore:
Timestamp:
04/05/2023 02:53:25 PM (3 years ago)
Author:
hellofromTonya
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #58087, comment 4

    initial v1  
    88
    99* The declared `data` property was later removed in 4.4.0 via [35269] / #34348 to fix a data type incompatibility with `WP_Ajax_Response`:
    10 >`wp_ajax_add_term()` fetches a term using `get_term()`, and passes the term to
    11 `WP_Ajax_Response`, which expects each of the term's properties to be scalar.
    12 Having `$data` as a `stdClass` (meant to mimic `WP_User::data`, populated by
    13 a `get_row()` database query) violated this expectation, causing fatal string
    14 conversion errors. As a workaround, `$term->data` is converted so that it is
    15 no longer an actual property of the term object, but is assembled only when
    16 requested in the magic `__get()` method.
     10>`wp_ajax_add_term()` fetches a term using `get_term()`, and passes the term to `WP_Ajax_Response`, which expects each of the term's properties to be scalar. Having `$data` as a `stdClass` (meant to mimic `WP_User::data`, populated by a `get_row()` database query) violated this expectation, causing fatal string conversion errors. As a workaround, `$term->data` is converted so that it is no longer an actual property of the term object, but is assembled only when requested in the magic `__get()` method.
    1711
    1812Notice the following: