From 02216c53fb9d570bfb0238aae9e52c877279c6f0 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/UPGRADE.md b/UPGRADE.md index 2500e7f12aa..2dc65f61afc 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,20 @@ # Upgrade to 2.12 +## Deprecated colon prefix for prepared statement parameters + +The usage of the colon prefix when binding named parameters is deprecated. + + $sql = 'SELECT * FROM users WHERE name = :name OR username = :username'; + $stmt = $conn->prepare($sql); + + // The usage of the 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: