As PHP 8 reports the actual transaction state in the MySQL PDO driver, running multiple statements with DB\SQL::exec() can break if any of those statements causes the transaction to end early (as is the case in things like schema changes). This was silently ignored in PHP 5/7, but under PHP 8 it can break without these additional checks.
This is not the only way to handle this change, and it may be something better left to the end-user. It may also affect performance and potentially break some behavior, though I didn't notice any major differences.
User code could instead just call DB\SQL::exec() in a loop when transactions cannot not be used, but this did affect projects I maintain when running under PHP 8 so I figured I'd open a PR for feedback.
As PHP 8 reports the actual transaction state in the MySQL PDO driver, running multiple statements with
DB\SQL::exec()
can break if any of those statements causes the transaction to end early (as is the case in things like schema changes). This was silently ignored in PHP 5/7, but under PHP 8 it can break without these additional checks.This is not the only way to handle this change, and it may be something better left to the end-user. It may also affect performance and potentially break some behavior, though I didn't notice any major differences.
User code could instead just call
DB\SQL::exec()
in a loop when transactions cannot not be used, but this did affect projects I maintain when running under PHP 8 so I figured I'd open a PR for feedback.