diff options
| author | Matteo Beccati <mbeccati@php.net> | 2014-11-06 15:46:49 +0100 |
|---|---|---|
| committer | Matteo Beccati <mbeccati@php.net> | 2014-11-06 15:47:32 +0100 |
| commit | 8fdc4d8797e176f9bb8d9f9509a45346478d9cc1 (patch) | |
| tree | 72f631599bec7f8708c3f474aad02c5e0fc8e921 | |
| parent | 53266476e63608e4ce03c6d584864755806b28fe (diff) | |
| download | php-git-8fdc4d8797e176f9bb8d9f9509a45346478d9cc1.tar.gz | |
Fixed bug #68351 (PDO::PARAM_BOOL and ATTR_EMULATE_PREPARES misbehaving)
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | ext/pdo_pgsql/pgsql_statement.c | 1 | ||||
| -rw-r--r-- | ext/pdo_pgsql/tests/bug62593.phpt | 15 |
3 files changed, 18 insertions, 0 deletions
@@ -36,6 +36,8 @@ PHP NEWS . Fixed bug #66584 (Segmentation fault on statement deallocation) (Matteo) . Fixed bug #67462 (PDO_PGSQL::beginTransaction() wrongly throws exception when not in transaction) (Matteo) + . Fixed bug #68351 (PDO::PARAM_BOOL and ATTR_EMULATE_PREPARES misbehaving) + (Matteo) - SPL: . Fixed bug #68128 (Regression in RecursiveRegexIterator) (Tjerk) diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 1fa7ce4777..4e183311e2 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -370,6 +370,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * ((param->param_type & PDO_PARAM_INPUT_OUTPUT) != PDO_PARAM_INPUT_OUTPUT)) { SEPARATE_ZVAL(¶m->parameter); param->param_type = PDO_PARAM_STR; + convert_to_boolean(param->parameter); ZVAL_STRINGL(param->parameter, Z_BVAL_P(param->parameter) ? "t" : "f", 1, 1); } } diff --git a/ext/pdo_pgsql/tests/bug62593.phpt b/ext/pdo_pgsql/tests/bug62593.phpt index e3ebf46ed5..4ab4566f00 100644 --- a/ext/pdo_pgsql/tests/bug62593.phpt +++ b/ext/pdo_pgsql/tests/bug62593.phpt @@ -34,6 +34,19 @@ $query->execute(); $errors[] = $query->errorInfo(); var_dump($value); +// Try with strings - Bug #68351 +$value = '0'; +$query->bindParam(':foo', $value, PDO::PARAM_BOOL); +$query->execute(); +$errors[] = $query->errorInfo(); +var_dump($query->fetchColumn()); + +$value = "abc"; +$query->bindParam(':foo', $value, PDO::PARAM_BOOL); +$query->execute(); +$errors[] = $query->errorInfo(); +var_dump($query->fetchColumn()); + $expect = 'No errors found'; foreach ($errors as $error) @@ -48,4 +61,6 @@ echo $expect; --EXPECTF-- bool(true) bool(false) +bool(true) +bool(false) No errors found |
