[wp-trac] [WordPress Trac] #41257: translate( null, "domain" ) returns translation of "0" rather than null

WordPress Trac noreply at wordpress.org
Thu Jul 6 09:13:16 UTC 2017


#41257: translate( null, "domain" ) returns translation of "0" rather than null
--------------------------+-----------------------------
 Reporter:  bobbingwide   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 This could be a case of garbage in = garbage out but I noticed that
 calling

 `translate( null, "domain" )` or `translate( "", "domain" )` produces an
 unexpected result when

 - the text domain for "domain" is loaded
 - and it contains a translation for "0".

 === Expected output ===
 null or null string

 === Actual output ===
 translation of the `"0"` string

 === Workaround ===
 Don't call translate() this way.

 === Question ===
 Could/should there be a unit test to confirm what should happen?

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


More information about the wp-trac mailing list