Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #59239, comment 5


Ignore:
Timestamp:
01/09/2026 12:02:41 PM (10 months ago)
Author:
joppuyo

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #59239, comment 5

    initial v1  
    33It seems like wp_rand() is a wrapper around random_int() and it only uses a fallback if the random_int() throws an exception (no random source available) or the function is not available. As it was added in PHP 7.0 that's probably not relevant in current WordPress versions as they don't support PHP 5 any longer.
    44
    5 I think it could be possible to just use random_int() directly if wp_rand() is not available. If that's too much duplicate code it might be possible to drop wp_rand() completely so the function works without the dependency on pluggable functions being loaded.
     5I think it could be possible to just use random_int() directly if wp_rand() is not available. If that's too much duplicate code it might be possible to drop wp_rand() completely and just use random_int() so the function works without the dependency on pluggable functions being loaded.