chrisblakley / Nebula

Nebula is a WordPress theme framework that focuses on enhancing development. The core features of Nebula make it a powerful tool for designing, developing, and analyzing WordPress websites consistently, yet its deliberately uncomplicated code syntax also serves as a learning resource for programmers themselves.
https://nebula.gearside.com
GNU General Public License v2.0
139 stars 36 forks source link

PHP is deprecating rand() functions in PHP 8.3 #2247

Open chrisblakley opened 1 year ago

chrisblakley commented 1 year ago

Will need to find alternatives throughout Nebula and monitor vendor libraries for support as well.

https://wiki.php.net/rfc/deprecations_php_8_3#mt_rand_php

Screenshot 2023-05-29 at 7 53 07 PM

Seems like random_int() is the alternative now.

chrisblakley commented 1 year ago

Locations in Nebula itself where these appear:

Also appears in scssphp (x5) and plugin-update-checker (x2). There is an update available to the latter, but I doubt it addresses this quite yet.

chrisblakley commented 1 year ago

Need to find an alternative to mt_getrandmax() as well which is used in metadata.php.

'?nocache' . mt_rand(1000, mt_getrandmax()) . '=debug' . mt_rand(1000, mt_getrandmax())

This is what I came up with:

'?nocache' . random_int(1000, PHP_INT_MAX) . '=debug' . random_int(1000, PHP_INT_MAX)

However, for this particular implementation I'll probably simplify to:

'?nocache' . random_int(100000, 999999) . '=debug' . random_int(100000, 999999)
chrisblakley commented 1 year ago

Nebula has been updated, but still needs scssphp and plugin-update-checker to be updated before this can be closed.

Note that random_int() requires the libsodium package in PHP, so make sure that is always installed on servers.

chrisblakley commented 1 month ago

Here is what vendor libraries are using: