Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 1651abb

Browse files
committed
Merge branch 'hotfix/292'
Close #292 Fixes #291
2 parents 69118aa + 983fce2 commit 1651abb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5-
## 2.9.2 - TBD
5+
## 2.9.2 - 2017-12-11
66

77
### Added
88

@@ -22,7 +22,11 @@ All notable changes to this project will be documented in this file, in reverse
2222

2323
### Fixed
2424

25-
- Nothing.
25+
- [#292](https://github.com/zendframework/zend-db/pull/292) ensures that you may
26+
reference bound parameter names using a leading colon (`:`) character when
27+
using the PDO adapter. (The leading colon is not technically necessary, as the
28+
adapter will prefix for you; however, this ensures portability with vanilla
29+
PDO.)
2630

2731
## 2.9.1 - 2017-12-07
2832

src/Adapter/Driver/Pdo/Pdo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ public function getPrepareType()
304304
public function formatParameterName($name, $type = null)
305305
{
306306
if ($type === null && ! is_numeric($name) || $type == self::PARAMETERIZATION_NAMED) {
307+
$name = ltrim($name, ':');
307308
// @see https://bugs.php.net/bug.php?id=43130
308309
if (preg_match('/[^a-zA-Z0-9_]/', $name)) {
309310
throw new Exception\RuntimeException(sprintf(

test/Adapter/Driver/Pdo/PdoTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function getParamsAndType()
5353
[ '123foo', Pdo::PARAMETERIZATION_NAMED, ':123foo' ],
5454
[ 1, Pdo::PARAMETERIZATION_NAMED, ':1' ],
5555
[ '1', Pdo::PARAMETERIZATION_NAMED, ':1' ],
56+
[ ':foo', null, ':foo' ],
5657
];
5758
}
5859

0 commit comments

Comments
 (0)