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

WordPress Trac noreply at wordpress.org
Mon Feb 22 20:05:05 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
Component:  I18N                                 |  Release
 Severity:  normal                               |     Version:  trunk
 Keywords:  has-patch has-unit-tests needs-      |  Resolution:
  refresh                                        |     Focuses:
-------------------------------------------------+-------------------------
Changes (by swissspidy):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests needs-
     refresh
 * milestone:  Awaiting Review => Future Release


Comment:

 That's a pretty cool event!

 Please note that the value passed to `number_format_i18n()` needs to be a
 `float`, not an `int`. See #35893. Otherwise the precision (second
 parameter) doesn't really make sense.

 That means tests are needed for floating point values, perhaps using a
 data provider.

 Oh, and I wouldn't reset `$wp_locale` in the tests, as other tests might
 rely on this global variable. Instead, I'd recommend using custom
 `setUp()` and `tearDown()` methods to properly reset the object.

 Let me know if you need any help with that.

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


More information about the wp-trac mailing list