[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 01:36:02 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 changes-requested                     |
-------------------------------------------------+-------------------------
Changes (by costdev):

 * keywords:  needs-unit-tests has-patch dev-feedback => needs-unit-tests
     has-patch dev-feedback changes-requested


Comment:

 The current patch causes errors in the tests and one test failure.

 Errors:
 - 2x `Trying to access array offset on value of type int` when an integer
 is passed. `$value` should be cast to `string`.

 Failure:
 - Test value: `'128m '` (note the trailing whitespace)
 - Expected result: `134217728`
 - Actual result: `128`

 See `tests/phpunit/tests/load/wpConvertHrToBytes.php` at line 34 for the
 datasets.
 Run `vendor/bin/phpunit --filter Tests_Load_wpConvertHrToBytes` to run the
 tests locally.

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


More information about the wp-trac mailing list