From: Will Fitch Date: Mon, 24 Sep 2012 17:31:20 +0000 (-0400) Subject: Bug #62593 Added test for change X-Git-Tag: php-5.4.9RC1~10^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0835c002d473a50d13d0fd7366224ffbd1431ab;p=php Bug #62593 Added test for change --- diff --git a/ext/pdo_pgsql/tests/bug62593.phpt b/ext/pdo_pgsql/tests/bug62593.phpt new file mode 100644 index 0000000000..3caf30814a --- /dev/null +++ b/ext/pdo_pgsql/tests/bug62593.phpt @@ -0,0 +1,44 @@ +--TEST-- +PDO PgSQL Bug #62593 (Emulate prepares behave strangely with PARAM_BOOL) +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_EMULATE_PREPARES, true); +$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); +$errors = array(); + +$query = $db->prepare('SELECT :foo IS FALSE as val_is_false'); +$query->bindValue(':foo', true, PDO::PARAM_BOOL); +$query->execute(); +$errors[] = $query->errorInfo(); + +$query->bindValue(':foo', 0, PDO::PARAM_BOOL); +$query->execute(); +$errors[] = $query->errorInfo(); + +$query->bindValue(':foo', false, PDO::PARAM_BOOL); +$query->execute(); +$errors[] = $query->errorInfo(); + +$expect = 'No errors found'; + +foreach ($errors as $error) +{ + if (strpos('Invalid text representation', $error[2]) !== false) + { + $expect = 'Invalid boolean found'; + } +} +echo $expect; +?> +--EXPECTF-- + +No errors found