[wp-trac] [WordPress Trac] #57923: Deprecated notice fired by wp_set_object_terms() with PHP 8.1

WordPress Trac noreply at wordpress.org
Wed Mar 15 12:11:50 UTC 2023


#57923: Deprecated notice fired by wp_set_object_terms() with PHP 8.1
-------------------------------------------+---------------------
 Reporter:  Chouby                         |       Owner:  (none)
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  6.3
Component:  Taxonomy                       |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  php81 needs-patch 2nd-opinion  |     Focuses:
-------------------------------------------+---------------------

Comment (by Chouby):

 I also noticed that the doc block doesn't explicitely accept `null` as
 parameter and that the parameter comment was ambiguous with this "empty
 value" which could in fact be interpreted as accepting `null`.

 As a plugin developer, I don't believe that adding a `_doing_it_wrong()`
 would be helpful in this case. This just would add a notice on top of
 another notice.

 In my opinion, there are only 2 alternatives. Either WordPress officially
 accepts `null` by updating the code and doc block. Or it is considered
 useless to officially accept it and the
 [https://core.trac.wordpress.org/ticket/57923#comment:4 small adjustement
 in the doc block] suggested by @costdev  would look perfect to me.

 For the records:
 - I noticed that [https://core.trac.wordpress.org/ticket/57923#comment:4
 `wp_set_post_terms()` accepts null] even if not documented.
 - And there are [https://wpdirectory.net/search/01GVJGMB7QVZDCNGEZH12RZ4XT
 at least 74 plugins] which still use `null` to remove terms from an
 object.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57923#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list