[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:54:59 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         |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by nacin):

 Replying to [ticket:25155 tivnet]:
 > What happens if `get_term_link` returns `WP_Error`, in this case?

 get_term_link() only returns WP_Error if the term doesn't exist. In this
 case, we know the term exists.

 I'm not sure if `__toString()` for WP_Error is a good idea. Right now,
 failing to catch a WP_Error often leads to a fatal error — which is often
 good, rather than bad, as it alerts developers to problems as they write
 their code. But more so, as you state — I'm not sure if it should be
 get_error_message(), or an empty string.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25155#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list