Skip to content

Commit 729bd48

Browse files
committed
Deprecate mysqli_ping
1 parent 4a77a1e commit 729bd48

9 files changed

+22
-13
lines changed

ext/mysqli/mysqli.stub.php

+2
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,7 @@ public function more_results(): bool {}
881881
public function next_result(): bool {}
882882

883883
/**
884+
* @deprecated
884885
* @tentative-return-type
885886
* @alias mysqli_ping
886887
*/
@@ -1533,6 +1534,7 @@ function mysqli_options(mysqli $mysql, int $option, $value): bool {}
15331534
*/
15341535
function mysqli_set_opt(mysqli $mysql, int $option, $value): bool {}
15351536

1537+
/** @deprecated */
15361538
function mysqli_ping(mysqli $mysql): bool {}
15371539

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

ext/mysqli/mysqli_arginfo.h

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/mysqli/tests/070.phpt

+3-1
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 in %s
1921
bool(true)
2022
done!

ext/mysqli/tests/071.phpt

+4-4
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

+2-1
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 in %s
104105
DONE

ext/mysqli/tests/mysqli_max_links.phpt

+1-1
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

+7-1
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 in %s
4042
bool(true)
43+
44+
Deprecated: Function mysqli_ping() is deprecated in %s
4145
bool(true)
46+
47+
Deprecated: Function mysqli_ping() is deprecated in %s
4248
mysqli object is already closed
4349
done!

ext/mysqli/tests/mysqli_report.phpt

-1
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

-1
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)