Skip to content

Commit cbcad9f

Browse files
Deprecate mysqli_ping (#11945)
1 parent 00001c4 commit cbcad9f

File tree

9 files changed

+46
-13
lines changed

9 files changed

+46
-13
lines changed

ext/mysqli/mysqli.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ public function next_result(): bool {}
878878
* @tentative-return-type
879879
* @alias mysqli_ping
880880
*/
881+
#[\Deprecated(since: '8.4', message: 'because the reconnect feature has been removed in PHP 8.2 and this method is now redundant')]
881882
public function ping(): bool {}
882883

883884
/**
@@ -1526,6 +1527,7 @@ function mysqli_options(mysqli $mysql, int $option, $value): bool {}
15261527
*/
15271528
function mysqli_set_opt(mysqli $mysql, int $option, $value): bool {}
15281529

1530+
#[\Deprecated(since: '8.4', message: 'because the reconnect feature has been removed in PHP 8.2 and this function is now redundant')]
15291531
function mysqli_ping(mysqli $mysql): bool {}
15301532

15311533
function mysqli_poll(?array &$read, ?array &$error, array &$reject, int $seconds, int $microseconds = 0): int|false {}

ext/mysqli/mysqli_arginfo.h

Lines changed: 27 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/mysqli/tests/070.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ require_once 'skipifconnectfailure.inc';
1515
$mysql->close();
1616
print "done!";
1717
?>
18-
--EXPECT--
18+
--EXPECTF--
19+
20+
Deprecated: Method mysqli::ping() is deprecated since 8.4, because the reconnect feature has been removed in PHP 8.2 and this method is now redundant in %s
1921
bool(true)
2022
done!

ext/mysqli/tests/071.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ require_once 'skipifconnectfailure.inc';
1313
$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
1414
$version = $mysql->server_version;
1515

16-
var_dump($mysql->ping());
16+
var_dump($mysql->query('DO 1'));
1717

1818
$ret = $mysql->kill($mysql->thread_id);
1919
if ($ret !== true){
2020
printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
2121
}
2222

23-
var_dump($mysql->ping());
23+
var_dump($mysql->query('DO 1'));
2424

2525
$mysql->close();
2626

2727
$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
2828

29-
var_dump(mysqli_ping($mysql));
29+
var_dump($mysql->query('DO 1'));
3030

3131
$ret = $mysql->kill($mysql->thread_id);
3232
if ($ret !== true){
3333
printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
3434
}
3535

36-
var_dump(mysqli_ping($mysql));
36+
var_dump($mysql->query('DO 1'));
3737

3838
$mysql->close();
3939
print "done!";

ext/mysqli/tests/mysqli_insert_id_variation.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,6 @@ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_insert_id_var"))
100100

101101
mysqli_close($link);
102102
?>
103-
--EXPECT--
103+
--EXPECTF--
104+
Deprecated: Method mysqli::ping() is deprecated since 8.4, because the reconnect feature has been removed in PHP 8.2 and this method is now redundant in %s
104105
DONE

ext/mysqli/tests/mysqli_max_links.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mysqli.max_links=1
1414
require_once 'table.inc';
1515

1616
// to make sure we have at least one working connection...
17-
var_dump(mysqli_ping($link));
17+
var_dump($link->query('DO 1'));
1818
// to make sure that max_links is really set to one
1919
var_dump((int)ini_get('mysqli.max_links'));
2020

ext/mysqli/tests/mysqli_ping.phpt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ require_once 'skipifconnectfailure.inc';
3636

3737
print "done!";
3838
?>
39-
--EXPECT--
39+
--EXPECTF--
40+
41+
Deprecated: Function mysqli_ping() is deprecated since 8.4, because the reconnect feature has been removed in PHP 8.2 and this function is now redundant in %s
4042
bool(true)
43+
44+
Deprecated: Function mysqli_ping() is deprecated since 8.4, because the reconnect feature has been removed in PHP 8.2 and this function is now redundant in %s
4145
bool(true)
46+
47+
Deprecated: Function mysqli_ping() is deprecated since 8.4, because the reconnect feature has been removed in PHP 8.2 and this function is now redundant in %s
4248
mysqli object is already closed
4349
done!

ext/mysqli/tests/mysqli_report.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ require_once 'skipifconnectfailure.inc';
4141
echo $e->getMessage() . \PHP_EOL;
4242
}
4343

44-
// mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
4544
mysqli_prepare($link, "FOO");
4645
mysqli_real_query($link, "FOO");
4746
if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))

ext/mysqli/tests/mysqli_report_wo_ps.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ if (mysqli_get_server_version($link) >= 50600)
5454
echo $e->getMessage() . \PHP_EOL;
5555
}
5656

57-
// mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
5857
mysqli_real_query($link, "FOO");
5958
if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
6059
printf("[009] select_db should have failed\n");

0 commit comments

Comments
 (0)