[wp-trac] [WordPress Trac] #40891: map_meta_cap() causing PHP notice on term meta permissions

WordPress Trac noreply at wordpress.org
Tue May 30 23:50:34 UTC 2017


#40891: map_meta_cap() causing PHP notice on term meta permissions
-----------------------------+-----------------------------
 Reporter:  caercam          |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Role/Capability  |    Version:  4.7
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Mentioned in #40889: when checking for permission to add/edit/delete term
 meta, `map_meta_cap()` only performs a simple boolean test to make sure
 the term exists: https://core.trac.wordpress.org/browser/tags/4.7/src/wp-
 includes/capabilities.php#L277

 If `get_term()` returns a `WP_Error` the test fails and `$term->taxonomy`
 causes an "Undefined property" notice. There should be an additional check
 using `is_wp_error()`, a simple `isset( $term->taxonomy )` or maybe a
 simpler `term_exists()` to make sure the term actually exists.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40891>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list