From 7b4f16ada5ee4a72f4a099731683cda66161aca0 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Tue, 3 Nov 2020 10:49:47 -0800 Subject: [PATCH] Deprecate colon prefix for prepared statement parameters --- UPGRADE.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/UPGRADE.md b/UPGRADE.md index 2500e7f12aa..161c9c75d73 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,22 @@ # Upgrade to 2.12 +## Deprecated colon prefix for prepared statement parameters + +The usage of the colon prefix when binding named parameters is deprecated. + +```php +$sql = 'SELECT * FROM users WHERE name = :name OR username = :username'; +$stmt = $conn->prepare($sql); + +// The usage of the leading colon is deprecated +$stmt->bindValue(':name', $name); + +// Only the parameter name should be passed +$stmt->bindValue('username', $username); + +$stmt->execute(); +``` + ## PDO signature changes with php 8 In php 8.0, the method signatures of two PDO classes which are extended by DBAL have changed. This affects the following classes: