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..867929e8 --- /dev/null +++ b/docs/v4-to-v5-update.md @@ -0,0 +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) {