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

WordPress Trac noreply at wordpress.org
Fri Feb 18 13:17:26 UTC 2022

#55194: wp_rand( 0, 0)  result in random integer
 Reporter:  mlajo         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  6.0
Component:  General       |     Version:  5.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  docs

Comment (by mlajo):

 Replying to [comment:3 SergeyBiryukov]:

 > This is also consistent with `mt_rand()`, which returns a random integer
 and not 0 when parameters are omitted. So changing this behavior does not
 seem feasible due to security implications, but we can update the
 documentation to mention that the `$max` value is only taken into account
 if it's greater than zero.

 mt_rand( 0, 0 ) returns 0

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

More information about the wp-trac mailing list