From dbf56e0eba68c61385e9a2d15a3e3f5066f80ec4 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Sun, 14 Dec 2025 15:23:43 +0000 Subject: [PATCH] Squashed commit of the following: commit c4adcbe582faa263f11404ac89eb2cb80f2bdbca Author: Kamil Tekiela Date: Fri Oct 17 15:32:14 2025 +0100 Add NEWS commit 84a6e675af9c1cf74c17f06aeca84cca358e064b Author: Kamil Tekiela Date: Fri Oct 17 14:49:26 2025 +0100 Handle errors in mysqli_begin_transaction --- NEWS | 5 ++- ext/mysqli/mysqli_nonapi.c | 3 ++ .../tests/mysqli_begin_transaction_error.phpt | 42 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 ext/mysqli/tests/mysqli_begin_transaction_error.phpt diff --git a/NEWS b/NEWS index ed2c4149a03..13f673a53c0 100644 --- a/NEWS +++ b/NEWS @@ -8,7 +8,7 @@ PHP NEWS - Bz2: . Fixed bug GH-20620 (bzcompress overflow on large source size). - (David Carlier) + (David Carlier) - GD: . Fixed bug GH-20622 (imagestring/imagestringup overflow). (David Carlier) @@ -70,6 +70,9 @@ PHP NEWS . Fixed bug GH-20492 (mbstring compile warning due to non-strings). (ndossche) +- mysqli: + . Make mysqli_begin_transaction() report errors properly. (Kamil Tekiela) + - MySQLnd: . Fixed bug GH-20528 (Regression breaks mysql connexion using an IPv6 address enclosed in square brackets). (Remi) diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 406d9286997..1f971d000fa 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -1022,6 +1022,7 @@ PHP_FUNCTION(mysqli_begin_transaction) } if (FAIL == mysqlnd_begin_transaction(mysql->mysql, flags, name)) { + MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } RETURN_TRUE; @@ -1046,6 +1047,7 @@ PHP_FUNCTION(mysqli_savepoint) } if (FAIL == mysqlnd_savepoint(mysql->mysql, name)) { + MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } RETURN_TRUE; @@ -1069,6 +1071,7 @@ PHP_FUNCTION(mysqli_release_savepoint) RETURN_THROWS(); } if (FAIL == mysqlnd_release_savepoint(mysql->mysql, name)) { + MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } RETURN_TRUE; diff --git a/ext/mysqli/tests/mysqli_begin_transaction_error.phpt b/ext/mysqli/tests/mysqli_begin_transaction_error.phpt new file mode 100644 index 00000000000..e4d63f366e8 --- /dev/null +++ b/ext/mysqli/tests/mysqli_begin_transaction_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +mysqli_begin_transaction() +--EXTENSIONS-- +mysqli +--SKIPIF-- +errno, $link->error)); +?> +--FILE-- + +--CLEAN-- + +--EXPECT-- +Expecting an exception. +done!