Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  random: Fix unknown `mt_srand()` compatibility for unknown modes (#13544)
  Removed `REPORT_EXIT_STATUS=no` in libmysql tests
  Revert "Fix GH-13519: PGSQL_CONNECT_FORCE_RENEW with persistent connections." (#13546)
This commit is contained in:
Tim Düsterhus 2024-02-29 18:07:00 +01:00
commit e6c0b09e88
No known key found for this signature in database
GPG key ID: 8FF75566094168AF
3 changed files with 33 additions and 4 deletions

3
NEWS
View file

@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.3.5
- Random:
. Fixed bug GH-13544 (Pre-PHP 8.2 compatibility for mt_srand with
unknown modes). (timwolla)
14 Mar 2024, PHP 8.3.4

View file

@ -486,11 +486,13 @@ PHP_FUNCTION(mt_srand)
Z_PARAM_LONG(mode)
ZEND_PARSE_PARAMETERS_END();
state->mode = mode;
/* Anything that is not MT_RAND_MT19937 was interpreted as MT_RAND_PHP. */
if (state->mode != MT_RAND_MT19937) {
switch (mode) {
case MT_RAND_PHP:
state->mode = MT_RAND_PHP;
zend_error(E_DEPRECATED, "The MT_RAND_PHP variant of Mt19937 is deprecated");
break;
default:
state->mode = MT_RAND_MT19937;
}
if (seed_is_null) {

View file

@ -0,0 +1,24 @@
--TEST--
mt_srand(): Test unknown modes
--FILE--
<?php
// MT_RAND_MT19937
mt_srand(1, 0);
var_dump(mt_rand());
// MT_RAND_PHP
mt_srand(1, 1);
var_dump(mt_rand());
// Unknown
mt_srand(1, 2);
var_dump(mt_rand());
// Equivalent to 0 when cast as unsigned 8-bit integer
mt_srand(1, 256);
var_dump(mt_rand());
?>
--EXPECTF--
int(895547922)
Deprecated: The MT_RAND_PHP variant of Mt19937 is deprecated in %s on line %d
int(1244335972)
int(895547922)
int(895547922)