Skip to content

RFC: Change default mysqli error mode #6629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ PHP 8.1 UPGRADE NOTES
internally previously.
. The MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH option no longer has an effect.
. The MYSQLI_STORE_RESULT_COPY_DATA option no longer has an effect.
. The default error handling mode has been changed from "silent" to
"exceptions". See https://www.php.net/manual/en/mysqli-driver.report-mode.php
for details of behavior changes and how to explicitly set this attribute. To
keep the old behavior, use mysqli_report(MYSQLI_REPORT_OFF);
RFC: https://wiki.php.net/rfc/mysqli_default_errmode

- MySQLnd:
. The mysqlnd.fetch_copy_data ini setting has been removed. However, this
Expand Down
4 changes: 2 additions & 2 deletions ext/mysqli/mysqli.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ static PHP_GINIT_FUNCTION(mysqli)
mysqli_globals->default_pw = NULL;
mysqli_globals->default_socket = NULL;
mysqli_globals->reconnect = 0;
mysqli_globals->report_mode = 0;
mysqli_globals->report_mode = MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT;;
mysqli_globals->allow_local_infile = 0;
mysqli_globals->local_infile_directory = NULL;
mysqli_globals->rollback_on_cached_plink = FALSE;
Expand Down Expand Up @@ -826,7 +826,7 @@ PHP_RINIT_FUNCTION(mysqli)
#endif
MyG(error_msg) = NULL;
MyG(error_no) = 0;
MyG(report_mode) = 0;
MyG(report_mode) = MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT;

return SUCCESS;
}
Expand Down
1 change: 1 addition & 0 deletions ext/mysqli/tests/connect.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

$driver = new mysqli_driver;
$driver->report_mode = MYSQLI_REPORT_OFF;

$host = getenv("MYSQL_TEST_HOST") ?: "127.0.0.1";
$port = getenv("MYSQL_TEST_PORT") ?: 3306;
Expand Down
1 change: 1 addition & 0 deletions ext/mysqli/tests/mysqli_incomplete_initialization.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require_once('skipif.inc');
--FILE--
<?php

mysqli_report(MYSQLI_REPORT_OFF);
$mysqli = new mysqli();
@$mysqli->__construct('doesnotexist');
$mysqli->close();
Expand Down