-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restore pre-PHP 8 semantics for PDO::commit/rollBack after implicit c…
…ommit
- Loading branch information
Showing
1 changed file
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Zookeeper Online | ||
* | ||
* @author Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2022 Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2023 Jim Mason <[email protected]> | ||
* @link https://zookeeper.ibinx.com/ | ||
* @license GPL-3.0 | ||
* | ||
|
@@ -126,7 +126,8 @@ public function executeAndFetchAll($style=\PDO::FETCH_ASSOC) { | |
|
||
/** | ||
* PDO decorator that logs errors, as well as provides pre-MySQL 5.7.5 | ||
* semantics for GROUP BY queries | ||
* semantics for GROUP BY queries, and pre-PHP 8 semantics for commit/rollBack | ||
* after implicit commit | ||
*/ | ||
class BasePDO { | ||
private const LIBRARY_TABLES = [ | ||
|
@@ -178,6 +179,20 @@ public function __call($method, $args) { | |
return $ret; | ||
} | ||
|
||
public function commit() { | ||
// restore pre-PHP 8 semantics after implicit commit | ||
// see https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.pdo-mysql | ||
return $this->delegate->inTransaction() ? | ||
$this->delegate->commit() : true; | ||
} | ||
|
||
public function rollBack() { | ||
// restore pre-PHP 8 semantics after implicit commit | ||
// see https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.pdo-mysql | ||
return $this->delegate->inTransaction() ? | ||
$this->delegate->rollBack() : true; | ||
} | ||
|
||
public function prepare($stmt, $options = []) { | ||
// disable ONLY_FULL_GROUP_BY for pre-MySQL 5.7.5 legacy behaviour | ||
// see https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html | ||
|