[wp-trac] [WordPress Trac] #33330: Undefined property: stdClass::$slug

WordPress Trac noreply at wordpress.org
Wed Feb 10 20:28:18 UTC 2021


#33330: Undefined property: stdClass::$slug
-------------------------------------------------+-------------------------
 Reporter:  mattfiocca                           |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Plugins                              |     Version:  4.0
 Severity:  minor                                |  Resolution:
 Keywords:  2nd-opinion has-screenshots php8     |     Focuses:
  needs-unit-tests                               |
-------------------------------------------------+-------------------------
Changes (by jrf):

 * keywords:  2nd-opinion has-screenshots => 2nd-opinion has-screenshots
     php8 needs-unit-tests
 * severity:  normal => minor


Comment:

 Just making a note here that as of PHP 8.0, the notice `Undefined
 property: stdClass::$slug` will now be a `warning` due to the
 [https://wiki.php.net/rfc/engine_warnings Reclassified engine warnings].
 This may mean that more people will be exposed to the issue.

 As for the solution:
 This should preferably be solved in whichever plugin is causing the issue.

 As for the patch:
 In my opinion, as I stated above, if a patch should be accepted at all,
 the `trigger_error()` should be changed to a `_doing_it_wrong()` and I
 think the `break` will probably need to change to a `continue` (needs
 testing/further review).

 Adding unit tests for this particular issue, safeguarding the functioning
 of the code before and after, would increase the chances of a patch
 getting accepted.

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


More information about the wp-trac mailing list