Annotation of embedaddon/php/ext/pdo_pgsql/tests/bug62593.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: PDO PgSQL Bug #62593 (Emulate prepares behave strangely with PARAM_BOOL)
3: --SKIPIF--
4: <?php
5: if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
6: require dirname(__FILE__) . '/config.inc';
7: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
8: PDOTest::skip();
9: ?>
10: --FILE--
11: <?php
12: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
13: $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
14: $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
15: $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
16: $errors = array();
17:
18: $value = true;
19: $query = $db->prepare('SELECT :foo IS FALSE as val_is_false');
20: $query->bindValue(':foo', $value, PDO::PARAM_BOOL);
21: $query->execute();
22: $errors[] = $query->errorInfo();
23: var_dump($value);
24:
25: $query->bindValue(':foo', 0, PDO::PARAM_BOOL);
26: $query->execute();
27: $errors[] = $query->errorInfo();
28:
29: // Verify bindParam maintains reference and only passes when execute is called
30: $value = true;
31: $query->bindParam(':foo', $value, PDO::PARAM_BOOL);
32: $value = false;
33: $query->execute();
34: $errors[] = $query->errorInfo();
35: var_dump($value);
36:
37: $expect = 'No errors found';
38:
39: foreach ($errors as $error)
40: {
41: if (strpos('Invalid text representation', $error[2]) !== false)
42: {
43: $expect = 'Invalid boolean found';
44: }
45: }
46: echo $expect;
47: ?>
48: --EXPECTF--
49: bool(true)
50: bool(false)
51: No errors found
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>