[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
Wed Mar 26 19:01:28 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:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by kalonya):

 Replying to [comment:3 johnbillion]:
 > @kalonya What exactly is your server configuration please? In the ticket
 description you state that the OS is `Linux (64-bit)`. Are you running a
 32 bit version of PHP and OpenSSL on a 64 bit OS?

 Not me, but three of our clients. They use a 32-bit version of PHP on a
 64-bit OS. It doesn't happen on all 32-bit PHPs. Some implementations
 handle this problem by clamping 4294967295 to 2147483647, and some others
 just overflow and return -1. Unfortunately, I don't have access to their
 web server.

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


More information about the wp-trac mailing list