xref: /PHP-8.0/ext/pdo_pgsql/tests/bug72570.phpt (revision f8d79582)
1--TEST--
2PDO PgSQL Bug #72570 (Segmentation fault when binding parameters on a query without placeholders)
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
6require __DIR__ . '/config.inc';
7require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
8PDOTest::skip();
9?>
10--FILE--
11<?php
12require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
13$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
14$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
15
16$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
17
18$stmt = $db->prepare("SELECT 1");
19
20try {
21    var_dump($stmt->execute([1]));
22} catch (PDOException $e) {
23    var_dump($e->getCode());
24}
25
26?>
27--EXPECT--
28string(5) "08P01"
29