[wp-trac] [WordPress Trac] #55194: wp_rand( 0, 0) result in random integer

WordPress Trac noreply at wordpress.org
Wed Jun 8 20:09:30 UTC 2022


#55194: wp_rand( 0, 0)  result in random integer
-------------------------------------------------+-------------------------
 Reporter:  mlajo                                |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1
Component:  General                              |     Version:  5.9
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests needs-dev-  |     Focuses:  docs
  note                                           |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:24 audrasjb]:
 > In [changeset:"53473" 53473]:
 > {{{
 > #!CommitTicketReference repository="" revision="53473"
 > General: Ensure `wp_rand()` returns `0` when `$min` and `$max` values
 are equal to `0`.
 >
 > This changeset ensures `wp_rand()` returns zero instead of a random
 number when both `$min` and `$max` values are equal to zero.
 >
 > Fixes #55194.
 > }}}

 It might be helpful to mention in the dev note that this brings parity
 with the `random_int()` and `mt_rand()` native PHP functions.

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


More information about the wp-trac mailing list