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