So if I were to put on mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT)
before creating the connection, I'd expect it to report all errors in the form of exceptions, which it seemingly does. However, for some reason, I'm receiving an error warning I obviously can't catch if there's a mismatch in bind_param()
for bound variables or types. Here's an example message I'd get if I used too few or many variables to bind.
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement
Is this a bug with mysqli_sql_exception
? I could suppress the warning obviously, but that seems a bit hackish. On the other hand, if I do @
, I'll still get a meaningful message to catch anyway.
No data supplied for parameters in prepared statement
Still, I'd prefer not to do this if possible, but it seems like the only way, unless I'm completely missing something. I'm surprised I couldn't find any info regarding this anywhere. I suppose I could do something with set_error_handler()
, but I honestly think suppressing the warning is a better choice for this case.
Yes, there is still an inconsistency in the driver. Not every error is translated into ErrorException
yet, some are still just PHP warnings. It seems that a custom error handler is the only solution.