[wp-trac] [WordPress Trac] #25155: All functions returning string|WP_Error -- there is no WP_Error::__toString
WordPress Trac
noreply at wordpress.org
Tue Aug 27 12:33:18 UTC 2013
#25155: All functions returning string|WP_Error -- there is no WP_Error::__toString
--------------------------+-----------------------------
Reporter: tivnet | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: minor | Keywords:
--------------------------+-----------------------------
Example from `class-wp-terms-list-table.php` :
{{{
$actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View'
) . '</a>';
}}}
What happens if `get_term_link` returns `WP_Error`, in this case?
a) That part of the code, and all similar places should be fixed, I guess
- to check for error before printing.
b) A `WP_Error::__toString` method might help in some cases. It may return
an empty string, or some string constant, or `WP_Error::get_error_message`
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25155>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list