[wp-trac] [WordPress Trac] #55635: wp_convert_hr_to_bytes() report correct byte sizes for php.ini "shorthand" values

WordPress Trac noreply at wordpress.org
Thu Apr 28 00:42:39 UTC 2022


#55635: wp_convert_hr_to_bytes() report correct byte sizes for php.ini "shorthand"
values
-------------------------------------------------+-------------------------
 Reporter:  dmsnell                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Upload                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-unit-tests has-patch dev-      |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Thanks for the patch!

 Replying to [ticket:55635 dmsnell]:
 >  [35325] replaced the hard-coded byte size with overwritable constants
 but if there were any occasion for someone to change those constants in
 `wp-config.php` then we would actually want to preserve the hard-coded
 values in `wp_convert_hr_to_bytes()` since that function refers to code
 inside of PHP, not inside of WordPress.

 Just noting that these constants are defined unconditionally in
 `wp_initial_constants()`, and it is not possible to change them in `wp-
 config.php` without getting PHP warnings, so the comment that they are
 redefinable seems inaccurate. I think it's safe to continue using them
 here, as it is their intended purpose to be used across all of core for
 better readability, instead of "magic numbers".

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


More information about the wp-trac mailing list