Make WordPress Core

#57137 closed defect (bug) (invalid)

Upgrade to 6.1.1: Error in pluggable.php (function wp_rand)

Reported by: anniew86's profile anniew86 Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.1.1
Component: General Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

After upgrade a simple test WP to 6.1.1 some posts are not displayed and following error occures in pluggable.php in the body of function wp_rand:

Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/wp/wp-includes/pluggable.php on line 2660

The line number vary between 2660 and 2662.

Here the relevant coding with line numbers:

2655 // Use PHP's CSPRNG, or a compatible method.
2656 static $use_random_int_functionality = true;
2657 if ( $use_random_int_functionality ) {
2658   try {
2659   // wp_rand() can accept arguments in either order, PHP cannot.
2660   $_max = max( $min, $max );
2661   $_min = min( $min, $max );
2662   $val  = random_int( $_min, $_max );
2663   if ( false !== $val ) {

It doesn't help to increase the timeout.

All plugins are deactivated, the standard WP theme is used, WP is used in the network mode.

If the variable $use_random_int_functionality is set to false (line 2656) than the error doesn't occure but the post will not be rendered (inifitive processing)

Change History (6)

#1 @SergeyBiryukov
16 months ago

  • Description modified (diff)
  • Keywords reporter-feedback added
  • Milestone changed from Awaiting Review to 6.1.2

Hi there, welcome to WordPress Trac! Thanks for the report.

The function was indeed updated for WP 6.1 in [53473] / #55194 to bring parity with the random_int() and mt_rand() native PHP functions when $min and $max values are both equal to 0.

At a glance, I don't see yet whether than change is related or not. Moving to 6.1.2 for investigation.

  • Could you check if the issue occurs in both WP 6.1 and 6.1.1, or just 6.1.1?
  • What is the PHP version on the affected site?

#2 @anniew86
16 months ago

Hello, thanks a lot for your answer.

Here the details of the platform:

Server architecture: Linux 5.10.0-13-686 i686
Web server: Apache/2.4.54 (Debian)
PHP version: 7.4.30 (Does not support 64bit values)

I've found out, that I missed to deactivate one plugin: "Simple Lightbox" https://archetyped.com/tools/simple-lightbox/

When I deactivated it, the post are rendered as usual.

#3 @riccardodicurti
15 months ago

Hi @anniew86,
may I kindly ask you the precise steps to reproduce this error?

Thanks in advance

#4 @anniew86
15 months ago

it was an error in the plugin "Simple Lightbox", the authors corrected it in the last version 2.9.3, they mentioned it in the changelog: "Hotfix: WordPress 6.1 wp_rand() bug (32-bit platforms) (#974)" https://github.com/archetyped/simple-lightbox/issues/974

#5 @riccardodicurti
15 months ago

Thank you @anniew86 for the clarification.

@SergeyBiryukov can I close the ticket?

#6 @SergeyBiryukov
15 months ago

  • Keywords reporter-feedback removed
  • Milestone 6.1.2 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for the follow-up! Closing, as this turned out to be an issue with a plugin, not WordPress core.

Note: See TracTickets for help on using tickets.