From fbc4bab2325abf74a7fa257e6f550b198fa97263 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Thu, 12 Nov 2026 23:48:43 +0100 Subject: [PATCH 1/2] Add the update guide for 5.0 Several 5.0 changes need an entry in the update guide; adding the empty guide first keeps their pull requests from conflicting over its creation. Co-Authored-By: Claude Opus 5.5 --- docs/index.md | 1 + docs/v4-to-v5-update.md | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 docs/v4-to-v5-update.md diff --git a/docs/index.md b/docs/index.md index 656c20a5..40c23df3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,3 +2,4 @@ * [Updating from v1 to v2](v1-to-v2-update.md) * [Updating from v2 to v3](v2-to-v3-update.md) * [Updating from v3 to v4](v3-to-v4-update.md) +* [Updating from v4 to v5](v4-to-v5-update.md) diff --git a/docs/v4-to-v5-update.md b/docs/v4-to-v5-update.md new file mode 100644 index 00000000..68e9b2d5 --- /dev/null +++ b/docs/v4-to-v5-update.md @@ -0,0 +1,3 @@ +## Updating from v4 to v5 + +The following changes were made to the Database package between v4 and v5. From e9c8a58b719fbc1757ad0f183dd87d636997156e Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Thu, 12 Nov 2026 23:50:20 +0100 Subject: [PATCH 2/2] Return the bound parameters by value from getBounded() QueryInterface::getBounded() and DatabaseQuery::getBounded() returned by reference for no reason: the bindings reference the value property of the bound parameter objects, not the array slots. Implementations no longer need to declare the reference. Co-Authored-By: Claude Opus 5.5 --- docs/v4-to-v5-update.md | 7 +++++++ src/DatabaseDriver.php | 2 +- src/DatabaseQuery.php | 2 +- src/Pdo/PdoDriver.php | 2 +- src/QueryInterface.php | 2 +- src/Sqlsrv/SqlsrvDriver.php | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/v4-to-v5-update.md b/docs/v4-to-v5-update.md index 68e9b2d5..867929e8 100644 --- a/docs/v4-to-v5-update.md +++ b/docs/v4-to-v5-update.md @@ -1,3 +1,10 @@ ## Updating from v4 to v5 The following changes were made to the Database package between v4 and v5. + +### `getBounded()` no longer returns by reference + +`QueryInterface::getBounded()` and `DatabaseQuery::getBounded()` return the bound parameters by value. Implementations +of `QueryInterface` should drop the `&` from their declaration, and callers should not assign the result by reference +(`$bounded =& $query->getBounded()`). The bindings themselves still reference the bound variables, so `bind()` works as +before. diff --git a/src/DatabaseDriver.php b/src/DatabaseDriver.php index 81885d02..f320be04 100644 --- a/src/DatabaseDriver.php +++ b/src/DatabaseDriver.php @@ -627,7 +627,7 @@ public function execute() $this->count++; // Get list of bound parameters - $bounded =& $this->sql->getBounded(); + $bounded = $this->sql->getBounded(); // If there is a monitor registered, let it know we are starting this query if ($this->monitor) { diff --git a/src/DatabaseQuery.php b/src/DatabaseQuery.php index 6abc16f8..7eb37c9a 100644 --- a/src/DatabaseQuery.php +++ b/src/DatabaseQuery.php @@ -2029,7 +2029,7 @@ public function __clone() * * @since 1.5.0 */ - public function &getBounded($key = null) + public function getBounded($key = null) { if (empty($key)) { return $this->bounded; diff --git a/src/Pdo/PdoDriver.php b/src/Pdo/PdoDriver.php index cfb3d109..5043df84 100644 --- a/src/Pdo/PdoDriver.php +++ b/src/Pdo/PdoDriver.php @@ -432,7 +432,7 @@ public function execute() $this->count++; // Get list of bounded parameters - $bounded =& $this->sql->getBounded(); + $bounded = $this->sql->getBounded(); // If there is a monitor registered, let it know we are starting this query if ($this->monitor) { diff --git a/src/QueryInterface.php b/src/QueryInterface.php index d3c93cb0..1f60f792 100644 --- a/src/QueryInterface.php +++ b/src/QueryInterface.php @@ -835,7 +835,7 @@ public function unbind($key); * * @since 4.0 */ - public function &getBounded($key = null); + public function getBounded($key = null); /** * Method to modify a query already in string format with the needed additions to make the query limited to a particular number of diff --git a/src/Sqlsrv/SqlsrvDriver.php b/src/Sqlsrv/SqlsrvDriver.php index e2a430c7..f8fdbf76 100644 --- a/src/Sqlsrv/SqlsrvDriver.php +++ b/src/Sqlsrv/SqlsrvDriver.php @@ -575,7 +575,7 @@ public function execute() $this->count++; // Get list of bounded parameters - $bounded =& $this->sql->getBounded(); + $bounded = $this->sql->getBounded(); // If there is a monitor registered, let it know we are starting this query if ($this->monitor) {