xref: /PHP-8.4/ext/pdo_pgsql/tests/bug_14244.phpt (revision 53d7c174)
1--TEST--
2PDO PgSQL Bug #14244 (Postgres sees parameters in a dollar-delimited string)
3--EXTENSIONS--
4pdo
5pdo_pgsql
6--SKIPIF--
7<?php
8require __DIR__ . '/config.inc';
9require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14echo "Test\n";
15
16require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
17$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
18$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
19$pdo->setAttribute (\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
20
21echo "Already working (see bug64953.phpt):\n";
22
23$st = $pdo->prepare("SELECT '?' question");
24$st->execute();
25var_dump($st->fetch());
26
27echo "Inside a dollar-quoted string:\n";
28
29$st = $pdo->prepare("SELECT \$\$?\$\$ question");
30$st->execute();
31var_dump($st->fetch());
32
33?>
34Done
35--EXPECT--
36Test
37Already working (see bug64953.phpt):
38array(1) {
39  ["question"]=>
40  string(1) "?"
41}
42Inside a dollar-quoted string:
43array(1) {
44  ["question"]=>
45  string(1) "?"
46}
47Done
48