[wp-trac] [WordPress Trac] #22413: get_the_excerpt() missing a check on $post->post_excerpt
WordPress Trac
noreply at wordpress.org
Sun Nov 11 18:26:48 UTC 2012
#22413: get_the_excerpt() missing a check on $post->post_excerpt
-----------------------------+------------------------------
Reporter: johnjamesjacoby | Type: defect (bug)
Status: new | Priority: low
Milestone: Awaiting Review | Component: Warnings/Notices
Version: | Severity: minor
Keywords: has-patch |
-----------------------------+------------------------------
Functions like get_the_title() include isset() or !empty() checks on post
object variables, but get_the_excerpt() is missing any such check. This
missing check triggers PHP warnings if post_excerpt is not set.
has_excerpt() addresses this for template usage, but nothing addresses
this inside get_the_excerpt() itself.
Attached patch adds an isset() check, and correctly passes an empty string
if it doesn't.
(Possibly of note: other convenience functions have this same issue --
get_the_guid(), get_the_ID(), etc...)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22413>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list