diff --git a/NEWS b/NEWS index 3e4909c0eb0..98b49955f4d 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) @@ -22,7 +22,7 @@ PHP NEWS - Standard: . Fix error check for proc_open() command. (ndossche) - + 18 Dec 2025, PHP 8.4.16 - Core: @@ -74,6 +74,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 365c4891a09..6f2aa50117a 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -1018,6 +1018,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; @@ -1042,6 +1043,7 @@ PHP_FUNCTION(mysqli_savepoint) } if (FAIL == mysqlnd_savepoint(mysql->mysql, name)) { + MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } RETURN_TRUE; @@ -1065,6 +1067,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!