Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'ralphschindler/hotfix/db-mysqli-paramet…

…ercontainer'
  • Loading branch information...
commit f753e42b872ed082ebc16175c66e1dd01eac39a9 2 parents 9055e70 + c70b8aa
@EvanDotPro authored
View
34 library/Zend/Db/Adapter/Driver/Mysqli/Statement.php
@@ -219,24 +219,28 @@ public function execute($parameters = null)
*/
protected function bindParametersFromContainer(ParameterContainer $pContainer)
{
- $parameters = $pContainer->getPositionalArray();
+ $parameters = $pContainer->getNamedArray();
$type = '';
$args = array();
- foreach ($parameters as $position => &$value) {
- switch ($pContainer->offsetGetErrata($position)) {
- case ParameterContainer::TYPE_DOUBLE:
- $type .= 'd';
- break;
- case ParameterContainer::TYPE_NULL:
- $value = null; // as per @see http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148
- case ParameterContainer::TYPE_INTEGER:
- $type .= 'i';
- break;
- case ParameterContainer::TYPE_STRING:
- default:
- $type .= 's';
- break;
+ foreach ($parameters as $name => &$value) {
+ if ($pContainer->offsetHasErrata($name)) {
+ switch ($pContainer->offsetGetErrata($name)) {
+ case ParameterContainer::TYPE_DOUBLE:
+ $type .= 'd';
+ break;
+ case ParameterContainer::TYPE_NULL:
+ $value = null; // as per @see http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148
+ case ParameterContainer::TYPE_INTEGER:
+ $type .= 'i';
+ break;
+ case ParameterContainer::TYPE_STRING:
+ default:
+ $type .= 's';
+ break;
+ }
+ } else {
+ $type .= 's';
}
$args[] = &$value;
}
View
8 library/Zend/Db/Adapter/Driver/Pdo/Statement.php
@@ -224,10 +224,10 @@ public function execute($parameters = null)
protected function bindParametersFromContainer(ParameterContainer $container)
{
$parameters = $container->getNamedArray();
- foreach ($parameters as $position => &$value) {
+ foreach ($parameters as $name => &$value) {
$type = \PDO::PARAM_STR;
- if ($container->offsetHasErrata($position)) {
- switch ($container->offsetGetErrata($position)) {
+ if ($container->offsetHasErrata($name)) {
+ switch ($container->offsetGetErrata($name)) {
case ParameterContainer::TYPE_INTEGER:
$type = \PDO::PARAM_INT;
break;
@@ -244,7 +244,7 @@ protected function bindParametersFromContainer(ParameterContainer $container)
}
// parameter is named or positional, value is reference
- $parameter = is_int($position) ? ($position + 1) : $position;
+ $parameter = is_int($name) ? ($name + 1) : $name;
$this->resource->bindParam($parameter, $value, $type);
}
}

0 comments on commit f753e42

Please sign in to comment.
Something went wrong with that request. Please try again.