[wp-trac] [WordPress Trac] #19067: Duplicate functionality in core: size_format() and wp_convert_bytes_to_hr()

WordPress Trac wp-trac at lists.automattic.com
Thu Oct 27 20:06:46 UTC 2011


#19067: Duplicate functionality in core: size_format() and wp_convert_bytes_to_hr()
------------------------------+-----------------------------
 Reporter:  l3rady            |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Future Release
Component:  General           |     Version:  3.2.1
 Severity:  trivial           |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+-----------------------------

Comment (by ocean90):

 There could be a problem, because the output of both functions is
 different. {{{size_format}}} adds a space between number and unit.

 See also this output:

 {{{
 var_dump( size_format( 42353254 ) ); // string(5) "40 MB"
 var_dump( wp_convert_bytes_to_hr( 42353254 ) ); // string(14)
 "40.391210556MB"

 var_dump( size_format( 4.23 ) ); // string(4) "4 B "
 var_dump( wp_convert_bytes_to_hr( 4.23 ) ); // string(5) "4.23B"
 }}}

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


More information about the wp-trac mailing list