On Thu, 21 Jan 2021 at 21:51, Björn Larsson <bjorn.x.lars...@telia.com> wrote:
> If I understand this correctly, does it imply that a lot of > legacy code that works today, will not work any longer and > needs to change? Like: > if ("mysqlierror") { > "error handling" > } > > If so I think that like in other RFC's an investigation should > be done on how much code that is affected to assess BC impact. > The code will still work as it did before, but if there is an error then an exception will be thrown. This means that by default the custom error handlers will become redundant. Generally, this should not be a problem, but I can imagine that some projects heavily rely upon the manual error checking. Among the popular PHP projects that I know of, only CodeIgniter and WordPress still use mysqli. CI does offer PDO as an option but due to legacy reasons, many people still chose mysqli. However, they already use the exception mode. https://github.com/codeigniter4/CodeIgniter4/blob/d5673f4376dc981196607bc159368bee9990033c/system/Database/MySQLi/Connection.php#L94 WordPress ... the black sheep of PHP ... uses mysqli with a fallback to mysql_* API. They use manual error handling, which would be replaced by normal exceptions unless they silence it. They should modernize their codebase at some point as they can't cling on to the past forever. For the moment if they want to continue using manual error checking then they need to explicitly disable mysqli errors without relying on the default setting. That is only 1 additional line of code. This would be the same as what I have done in PHP internal test cases. I don't see any problems there. In fact, I don't really see this as a major breaking change. If any project really needs the mysqli errors silenced then they can just set the error mode back to OFF. The change is aimed at new users, not existing projects. Silenced error reporting was a source of confusion for plenty of beginners who were unaware of the setting. Kind Regards, Kamil Tekiela