[wp-trac] [WordPress Trac] #60364: Incorrect argument type given on number_format

WordPress Trac noreply at wordpress.org
Mon Jan 29 07:59:37 UTC 2024


#60364: Incorrect argument type given on number_format
--------------------------+------------------------------
 Reporter:  krishneup     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Site Health   |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Old description:

> Argument #1 ($num) must be of type float, string given in /var/www/src
> /wp-admin/includes/class-wp-debug-data.php:587

New description:

 `Argument #1 ($num) must be of type float, string given in /var/www/src
 /wp-admin/includes/class-wp-debug-data.php:587`

--

Comment (by sabernhardt):

 The PR proposes to run `floatval()` within `number_format()` on
 [https://github.com/WordPress/wordpress-
 develop/blob/e108d27762f375cab724789c2db1445c4bcd4477/src/wp-
 admin/includes/class-wp-debug-data.php#L585 line 585]:
 `'value' => number_format( floatval( $max_file_uploads ) ),`

 1. Should this test use `number_format_i18n()` instead of
 `number_format()`?
 2. Could it use `(float)` instead of `floatval()`?
 3. Would it be better to assign the type when setting the variable? \\
    `$max_file_uploads    = (float) ini_get( 'max_file_uploads' );`

 The test was added in [48535].

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


More information about the wp-trac mailing list