[wp-trac] [WordPress Trac] #35840: number_format_i18n throws a PHP error if a string is passed

WordPress Trac noreply at wordpress.org
Tue Mar 1 03:58:31 UTC 2016


#35840: number_format_i18n throws a PHP error if a string is passed
--------------------------------------------+-----------------------------
 Reporter:  pbearne                         |       Owner:
     Type:  defect (bug)                    |      Status:  new
 Priority:  normal                          |   Milestone:  Future Release
Component:  I18N                            |     Version:  2.3
 Severity:  normal                          |  Resolution:
 Keywords:  has-patch has-unit-tests close  |     Focuses:
--------------------------------------------+-----------------------------
Changes (by johnbillion):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests close
 * version:  trunk => 2.3


Comment:

 Raising a warning here is expected behaviour. PHP notices and warnings
 exist for a reason - if you pass a string to `number_format()`, you'll get
 a warning because it expects a float, so there's no reason why passing a
 string to `number_format_i18n()` should silently perform type coercion to
 avoid triggering a warning.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35840#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list