xref: /php-src/ext/pdo_pgsql/tests/bug71885.phpt (revision 6fb81d23)
1--TEST--
2Request #71855 (PDO placeholder escaping)
3--EXTENSIONS--
4pdo_pgsql
5--SKIPIF--
6<?php
7require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
8require_once dirname(__FILE__) . '/config.inc';
9PDOTest::skip();
10?>
11--FILE--
12<?php
13require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
14require_once dirname(__FILE__) . '/config.inc';
15$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
16$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
17$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM);
18
19foreach ([false, true] as $emulate) {
20    $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate);
21
22    try {
23        $stmt = $db->prepare('select ?- lseg \'((-1,0),(1,0))\'');
24        $stmt->execute();
25    } catch (PDOException $e) {
26        var_dump('ERR');
27    }
28
29    $stmt = $db->prepare('select ??- lseg \'((-1,0),(1,0))\'');
30    $stmt->execute();
31
32    var_dump($stmt->fetch());
33}
34
35?>
36==OK==
37--EXPECT--
38string(3) "ERR"
39array(1) {
40  [0]=>
41  string(1) "1"
42}
43array(1) {
44  [0]=>
45  string(1) "1"
46}
47==OK==
48