From 07cbe3083ab55d3b7203c1c2d6f9ca2a3977cd4f Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Tue, 27 Feb 2024 23:17:17 +0000 Subject: [PATCH 1/4] Revert "Fix GH-13519: PGSQL_CONNECT_FORCE_RENEW with persistent connections." (#13546) This reverts commit b9a9790be0657249fa5e6687883b43570b0a3f1f. From 99688dbe7aeb028a8dd005ef098121e5407ca8dd Mon Sep 17 00:00:00 2001 From: Saki Takamachi Date: Sun, 18 Feb 2024 21:39:00 +0900 Subject: [PATCH 2/4] Removed `REPORT_EXIT_STATUS=no` in libmysql tests --- .github/actions/test-libmysqlclient/action.yml | 1 - ext/pdo_mysql/tests/gh11550.phpt | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/test-libmysqlclient/action.yml b/.github/actions/test-libmysqlclient/action.yml index e408d0608f1..74474225e67 100644 --- a/.github/actions/test-libmysqlclient/action.yml +++ b/.github/actions/test-libmysqlclient/action.yml @@ -14,7 +14,6 @@ runs: export PDO_MYSQL_TEST_HOST=127.0.0.1 export PDO_MYSQL_TEST_USER=root export PDO_MYSQL_TEST_PASS=root - export REPORT_EXIT_STATUS=no sapi/cli/php run-tests.php -P -q \ -g FAIL,BORK,LEAK,XLEAK \ --no-progress --offline --show-diff --show-slow 1000 --set-timeout 120 \ diff --git a/ext/pdo_mysql/tests/gh11550.phpt b/ext/pdo_mysql/tests/gh11550.phpt index 5bf0b26497c..6460a77b6a1 100644 --- a/ext/pdo_mysql/tests/gh11550.phpt +++ b/ext/pdo_mysql/tests/gh11550.phpt @@ -13,6 +13,8 @@ MySQLPDOTest::skip(); require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'; $pdo = MySQLPDOTest::factory(); +$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $pdo->exec(<<<'SQL' CREATE TABLE `test_gh11550` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, @@ -51,9 +53,9 @@ array(1) { [0]=> array(4) { ["id"]=> - int(1) + string(1) "1" [0]=> - int(1) + string(1) "1" ["name"]=> string(5) "test1" [1]=> @@ -66,9 +68,9 @@ array(1) { [0]=> array(6) { ["id"]=> - int(1) + string(1) "1" [0]=> - int(1) + string(1) "1" ["name"]=> string(5) "test1" [1]=> From 116166cd3025c7f4e44089123e2f4d6fe629c1b1 Mon Sep 17 00:00:00 2001 From: Saki Takamachi Date: Thu, 29 Feb 2024 08:49:04 +0900 Subject: [PATCH 3/4] Merge branch 'PHP-8.2' into PHP-8.3 * PHP-8.2: Removed `REPORT_EXIT_STATUS=no` in libmysql tests --- .github/actions/test-libmysqlclient/action.yml | 1 - ext/pdo_mysql/tests/gh11550.phpt | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/test-libmysqlclient/action.yml b/.github/actions/test-libmysqlclient/action.yml index e408d0608f1..74474225e67 100644 --- a/.github/actions/test-libmysqlclient/action.yml +++ b/.github/actions/test-libmysqlclient/action.yml @@ -14,7 +14,6 @@ runs: export PDO_MYSQL_TEST_HOST=127.0.0.1 export PDO_MYSQL_TEST_USER=root export PDO_MYSQL_TEST_PASS=root - export REPORT_EXIT_STATUS=no sapi/cli/php run-tests.php -P -q \ -g FAIL,BORK,LEAK,XLEAK \ --no-progress --offline --show-diff --show-slow 1000 --set-timeout 120 \ diff --git a/ext/pdo_mysql/tests/gh11550.phpt b/ext/pdo_mysql/tests/gh11550.phpt index 5bf0b26497c..6460a77b6a1 100644 --- a/ext/pdo_mysql/tests/gh11550.phpt +++ b/ext/pdo_mysql/tests/gh11550.phpt @@ -13,6 +13,8 @@ MySQLPDOTest::skip(); require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'; $pdo = MySQLPDOTest::factory(); +$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); + $pdo->exec(<<<'SQL' CREATE TABLE `test_gh11550` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, @@ -51,9 +53,9 @@ array(1) { [0]=> array(4) { ["id"]=> - int(1) + string(1) "1" [0]=> - int(1) + string(1) "1" ["name"]=> string(5) "test1" [1]=> @@ -66,9 +68,9 @@ array(1) { [0]=> array(6) { ["id"]=> - int(1) + string(1) "1" [0]=> - int(1) + string(1) "1" ["name"]=> string(5) "test1" [1]=> From e059498c043c7325d38d2aa2caa8a5a5dfde4669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 29 Feb 2024 18:05:59 +0100 Subject: [PATCH 4/4] random: Fix unknown `mt_srand()` compatibility for unknown modes (#13544) PHP 8.1 and below interpreted unknown modes as `MT_RAND_MT19937`, but PHP 8.2+ interprets them as `MT_RAND_PHP`. Align the behavior with PHP 8.1 and below, because folks should be steered towards the standard mode. --- NEWS | 4 ++++ ext/random/random.c | 8 ++++++- .../01_functions/mt_srand_unknown_mode.phpt | 22 +++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 ext/random/tests/01_functions/mt_srand_unknown_mode.phpt diff --git a/NEWS b/NEWS index fa1a89dd1b0..18ebec1081f 100644 --- a/NEWS +++ b/NEWS @@ -45,6 +45,10 @@ PHP NEWS . Fixed bug GH-13354 (pg_execute/pg_send_query_params/pg_send_execute with null value passed by reference). (George Barbarosie) +- Random: + . Fixed bug GH-13544 (Pre-PHP 8.2 compatibility for mt_srand with + unknown modes). (timwolla) + - Standard: . Fixed array key as hash to string (case insensitive) comparison typo for the second operand buffer size (albeit unused for now). (A. Slepykh) diff --git a/ext/random/random.c b/ext/random/random.c index dda57f0fe7d..9f9da28962d 100644 --- a/ext/random/random.c +++ b/ext/random/random.c @@ -688,7 +688,13 @@ PHP_FUNCTION(mt_srand) Z_PARAM_LONG(mode) ZEND_PARSE_PARAMETERS_END(); - state->mode = mode; + switch (mode) { + case MT_RAND_PHP: + state->mode = MT_RAND_PHP; + break; + default: + state->mode = MT_RAND_MT19937; + } if (ZEND_NUM_ARGS() == 0) { php_random_mt19937_seed_default(status->state); diff --git a/ext/random/tests/01_functions/mt_srand_unknown_mode.phpt b/ext/random/tests/01_functions/mt_srand_unknown_mode.phpt new file mode 100644 index 00000000000..f4a3cc181cc --- /dev/null +++ b/ext/random/tests/01_functions/mt_srand_unknown_mode.phpt @@ -0,0 +1,22 @@ +--TEST-- +mt_srand(): Test unknown modes +--FILE-- + +--EXPECT-- +int(895547922) +int(1244335972) +int(895547922) +int(895547922)