Skip to content

Commit 4f58d5b

Browse files
authored
ext/mysqli: Deprecate passing the parameter to mysqli_store_result() (#15311)
And deprecate the MYSQLI_STORE_RESULT_COPY_DATA constant. RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_the_second_parameter_to_mysqli_store_result
1 parent 857ce2c commit 4f58d5b

7 files changed

+18
-283
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ PHP NEWS
4141
. The mysqli_refresh() function and mysqli::refresh() method are now deprecated.
4242
If this functionality is needed a SQL "FLUSH" command can be used instead.
4343
(Kamil Tekiela)
44+
. Passing explicitly the $mode parameter to mysqli_store_result() has been
45+
deprecated. As the MYSQLI_STORE_RESULT_COPY_DATA constant was only used in
46+
conjunction with this function it has also been deprecated. (Girgias)
4447

4548
- PHPDBG:
4649
. array out of bounds, stack overflow handled for segfault handler on windows.

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,10 @@ PHP 8.4 UPGRADE NOTES
457457
. The mysqli_refresh() function and mysqli::refresh() method are now deprecated.
458458
If this functionality is needed a SQL "FLUSH" command can be used instead.
459459
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_mysqli_refresh
460+
. Passing explicitly the $mode parameter to mysqli_store_result() has been
461+
deprecated. As the MYSQLI_STORE_RESULT_COPY_DATA constant was only used in
462+
conjunction with this function it has also been deprecated.
463+
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_the_second_parameter_to_mysqli_store_result
460464

461465
- PDO_PGSQL:
462466
. Using escaped question marks (??) inside dollar-quoted strings is deprecated.

ext/mysqli/mysqli.stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
/**
139139
* @var int
140140
* @cvalue MYSQLI_STORE_RESULT_COPY_DATA
141+
* @deprecated
141142
*/
142143
const MYSQLI_STORE_RESULT_COPY_DATA = UNKNOWN;
143144

ext/mysqli/mysqli_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,14 @@ PHP_FUNCTION(mysqli_store_result)
19571957
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|l", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) {
19581958
RETURN_THROWS();
19591959
}
1960+
1961+
if ((hasThis() && ZEND_NUM_ARGS() == 1) || ZEND_NUM_ARGS() == 2) {
1962+
zend_error(E_DEPRECATED, "Passing the $mode parameter is deprecated since 8.4, as it has been ignored since 8.1");
1963+
if (UNEXPECTED(EG(exception))) {
1964+
RETURN_THROWS();
1965+
}
1966+
}
1967+
19601968
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
19611969
result = mysql_store_result(mysql->mysql);
19621970
if (!result) {

ext/mysqli/tests/bug77597.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $mysqli->query('INSERT INTO test VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
1818

1919
$mysqli->real_query("SELECT * FROM test");
2020

21-
$result = $mysqli->store_result(MYSQLI_STORE_RESULT_COPY_DATA);
21+
$result = $mysqli->store_result();
2222

2323
$field = $result->fetch_field();
2424
var_dump($field->name);

ext/mysqli/tests/mysqli_store_result_buffered_c.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require_once 'skipifconnectfailure.inc';
1313
if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
1414
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
1515

16-
if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
16+
if (!is_object($res = mysqli_store_result($link)))
1717
printf("[004] Expecting object, got %s/%s. [%d] %s\n",
1818
gettype($res), $res, mysqli_errno($link), mysqli_error($link));
1919

ext/mysqli/tests/mysqli_store_result_copy.phpt

Lines changed: 0 additions & 281 deletions
This file was deleted.

0 commit comments

Comments
 (0)