[wp-trac] [WordPress Trac] #63099: wp_rand() function returns only 0 or 1 when called without parameters on 32-bit PHP systems

WordPress Trac noreply at wordpress.org
Fri Mar 14 10:40:11 UTC 2025


#63099: wp_rand() function returns only 0 or 1 when called without parameters on
32-bit PHP systems
--------------------------+------------------------------
 Reporter:  kalonya       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  6.7.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by kalonya):

 Maybe we should set the $max_random_number like this?

 {{{
 $max_random_number = PHP_INT_SIZE === 4 ? (float) PHP_INT_MAX * 2 + 1 :
 PHP_INT_MAX;
 }}}

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


More information about the wp-trac mailing list