[wp-trac] [WordPress Trac] #32786: In get_edit_term_link: $term validation
WordPress Trac
noreply at wordpress.org
Fri Jun 26 12:39:06 UTC 2015
#32786: In get_edit_term_link: $term validation
-------------------------+------------------
Reporter: tmatsuur | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.3
Component: Taxonomy | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+------------------
Changes (by boonebgorges):
* version: 4.2.2 =>
* milestone: Awaiting Review => 4.3
Comment:
Thanks all. As a rule, I think what's being encouraged here is not very
good practice. Functions that are supposed to return a string (in this
case, a URL) should not simply return `null` when bad input is provided.
Ideally, they'd return a meaningful error object. But, in the absence of
that, a PHP notice can be a helpful debugging tool for developers. If
you're passing a bad term ID or a bad taxonomy name to
`get_edit_term_link()`, you should know about it.
All this being said, the function is already odd in the sense that it
bails with `null` when the cap check is not met. So, for the sake of
consistency, it shouldn't do any harm to patch as suggested.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32786#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list