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

Commit

Permalink
Merge branch 'hotfix/292'
Browse files Browse the repository at this point in the history
Close #292
Fixes #291
  • Loading branch information
weierophinney committed Dec 11, 2017
2 parents 69118aa + 983fce2 commit 1651abb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

## 2.9.2 - TBD
## 2.9.2 - 2017-12-11

### Added

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

### Fixed

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

## 2.9.1 - 2017-12-07

Expand Down
1 change: 1 addition & 0 deletions src/Adapter/Driver/Pdo/Pdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ public function getPrepareType()
public function formatParameterName($name, $type = null)
{
if ($type === null && ! is_numeric($name) || $type == self::PARAMETERIZATION_NAMED) {
$name = ltrim($name, ':');
// @see https://bugs.php.net/bug.php?id=43130
if (preg_match('/[^a-zA-Z0-9_]/', $name)) {
throw new Exception\RuntimeException(sprintf(
Expand Down
1 change: 1 addition & 0 deletions test/Adapter/Driver/Pdo/PdoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function getParamsAndType()
[ '123foo', Pdo::PARAMETERIZATION_NAMED, ':123foo' ],
[ 1, Pdo::PARAMETERIZATION_NAMED, ':1' ],
[ '1', Pdo::PARAMETERIZATION_NAMED, ':1' ],
[ ':foo', null, ':foo' ],
];
}

Expand Down

0 comments on commit 1651abb

Please sign in to comment.