[wp-trac] [WordPress Trac] #37791: `Walker_Nav_Menu::start_el` accesses property of non-object and throws notice

WordPress Trac noreply at wordpress.org
Tue Aug 23 15:59:12 UTC 2016


#37791: `Walker_Nav_Menu::start_el` accesses property of non-object and throws
notice
--------------------------+------------------------------
 Reporter:  schlessera    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:  4.6
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------
Changes (by schlessera):

 * keywords:   => has-patch


Comment:

 > Assuming that the doc blocks throughout that method are correct, the
 four calls above should be transformed into an array access.
 Well, just found out this is not the case.

 I attached a new patch that fixes the specific issue by converting an
 eventual object into an array.

 There should be a consensus on how to pass arguments around in this
 context, and all the methods then need to conform to that. This would
 avoid unnecessary conversions and unexpected notices.

 Please ignore the first two patches, `37791-3.diff` should be the good
 one.

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


More information about the wp-trac mailing list