Skip to content

Commit c566502

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Squashed commit of the following:
2 parents 5269386 + c54abaa commit c566502

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ PHP NEWS
6060
. Fix some deprecations on newer libxml versions regarding input
6161
buffer/parser handling. (ndossche)
6262

63+
- mysqli:
64+
. Make mysqli_begin_transaction() report errors properly. (Kamil Tekiela)
65+
6366
- MySQLnd:
6467
. Fixed bug GH-20528 (Regression breaks mysql connexion using an IPv6 address
6568
enclosed in square brackets). (Remi)

ext/mysqli/mysqli_nonapi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
10311031
}
10321032

10331033
if (FAIL == mysqlnd_begin_transaction(mysql->mysql, flags, name)) {
1034+
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
10341035
RETURN_FALSE;
10351036
}
10361037
RETURN_TRUE;
@@ -1055,6 +1056,7 @@ PHP_FUNCTION(mysqli_savepoint)
10551056
}
10561057

10571058
if (FAIL == mysqlnd_savepoint(mysql->mysql, name)) {
1059+
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
10581060
RETURN_FALSE;
10591061
}
10601062
RETURN_TRUE;
@@ -1078,6 +1080,7 @@ PHP_FUNCTION(mysqli_release_savepoint)
10781080
RETURN_THROWS();
10791081
}
10801082
if (FAIL == mysqlnd_release_savepoint(mysql->mysql, name)) {
1083+
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
10811084
RETURN_FALSE;
10821085
}
10831086
RETURN_TRUE;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--TEST--
2+
mysqli_begin_transaction()
3+
--EXTENSIONS--
4+
mysqli
5+
--SKIPIF--
6+
<?php
7+
require_once 'skipifconnectfailure.inc';
8+
9+
require_once 'connect.inc';
10+
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
11+
die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
12+
13+
if (!have_innodb($link))
14+
die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
15+
?>
16+
--FILE--
17+
<?php
18+
require_once 'connect.inc';
19+
20+
mysqli_report(MYSQLI_REPORT_ALL & ~MYSQLI_REPORT_INDEX);
21+
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
22+
try {
23+
mysqli_query($link, sprintf('KILL %d', mysqli_thread_id($link)));
24+
} catch (mysqli_sql_exception) {
25+
// ignore
26+
}
27+
28+
try {
29+
mysqli_begin_transaction($link);
30+
} catch (mysqli_sql_exception $e) {
31+
echo "Expecting an exception.\n";
32+
}
33+
34+
echo "done!\n";
35+
?>
36+
--CLEAN--
37+
<?php
38+
require_once 'clean_table.inc';
39+
?>
40+
--EXPECT--
41+
Expecting an exception.
42+
done!

0 commit comments

Comments
 (0)