I would like to say that I completely agree with George. The BC is minimal.
We are not introducing any new functionality or removing any either. We are
just changing a default setting that was always there. The only code that
would be affected is the one that is currently relying on the default
setting. Most of the mysqli code should already have the setting
enabled/disabled explicitly. If your current code has mysqli error
reporting disabled then nothing will change for you. If your current code
has mysqli error reporting enabled then nothing will change for you. It
will only change in the code that doesn't have it enabled/disabled yet.
Such a project would need to decide whether to enable it or disable it.
This can be done even now, and it should be done now, regardless of whether
this RFC is accepted or not.

> Or (probably more what you have in mind) that they should add
mysqli_report(MYSQLI_REPORT_ERROR) now (to prepare for the change) and
switch to MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT later once they know
they are ready.

IMHO the warning mode is useless as it doesn't stop the code execution
automatically but still throws an error. You either enable error reporting
in the form of exceptions, or you keep it silenced. I believe changing the
default mode to warning mode makes no sense.
Bear in mind that you can do it right now. There's no need for you to wait
for PHP 8.1 to see the change. You can decide on the error reporting mode
right now. However, I fail to see how mysqli_report(MYSQLI_REPORT_ERROR)
could help in migrating the code. As long as your code doesn't have any
errors, the error reporting mode will make no difference.

> This is where you are missing a key component: I want to go through a
phase where I will notice parts where manual error handling (or exception
handling after the change) is missing without having my application abort.
This is what warnings are good for.

Enabling warning mode will not help you in finding places where you are
missing manual error handling. That is the whole point. Manual error
handling means that you have to do it manually. When you enable warnings or
exceptions then manual error handling is already useless. If you think that
your code is missing some manual error handling then enabling
warning/exception mode will not reveal to you where these places are. You
have to go line by line through your code and everwhere you see a mysqli
method/function call you have to add manual error handling.

I want to make things straight. Changing the default error mode is not
forcing anyone to use exception mode out of the sudden. You can still
continue to use whichever mode you are using right now. The change is aimed
at people who start their new projects with PHP 8.1 and want to learn
mysqli.

> I don't see what testing needs to be done, you're reverting to the
previous state which supposedly is already working.

I also do not know what kind of additional testing would be required. The
functionality stays the same. A project code should remain the same unless
its maintainers decide to refactor it. All that is needed is to make sure
that the project has the correct mode enabled and does not rely on the
default setting.

Reply via email to