Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Passing A $mode To mysqli_store_result() Is Deprecated

mysqli_store_result() used to accept an optional $mode flag telling mysqlnd whether to copy fetched data out of its internal buffer. As of PHP 8.1, mysqlnd’s internal buffering changed and this flag stopped having any effect: it is silently ignored no matter what is passed, without any notice. In PHP 8.4, passing the parameter at all, regardless of its value, additionally emits a deprecation notice; the (lack of) effect on the actual buffering behavior is unchanged, only the notice is new.

PHP code

<?php

mysqli_report(MYSQLI_REPORT_OFF);
$mysqli = mysqli_init();
@$mysqli->real_connect('127.0.0.1', 'nouser', 'nopass', 'nodb', 1);
try {
    var_dump(mysqli_store_result($mysqli, 0));
} catch (\Throwable $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n";
}

Before

Error: mysqli object is not fully initialized

After

PHP Deprecated:  Passing the $mode parameter is deprecated since 8.4, as it has been ignored since 8.1 in /codes/mysqliStoreResultModeDeprecated.php on line 7

Deprecated: Passing the $mode parameter is deprecated since 8.4, as it has been ignored since 8.1 in /codes/mysqliStoreResultModeDeprecated.php on line 7
Error: mysqli object is not fully initialized

PHP version change

This behavior was deprecated in 8.4.

This behavior changed in .

See Also

Error Messages

Extension

© 2023-2026, Damien Seguy - Exakat