xref: /PHP-7.2/ext/pdo_pgsql/tests/bug72570.phpt (revision 8e0594a9)
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 dirname(__FILE__) . '/config.inc';
7require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
8PDOTest::skip();
9?>
10--FILE--
11<?php
12require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
13$db = PDOTest::test_factory(dirname(__FILE__) . '/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