summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql/tests
diff options
context:
space:
mode:
authorMatteo Beccati <mbeccati@php.net>2016-07-10 14:36:07 +0200
committerAnatol Belski <ab@php.net>2016-07-14 12:05:40 +0200
commit0f182c2495f3aa84aed76485a4406b383c77c785 (patch)
treebbe78e5905038b58cc987d41a08ffd83d01c28ea /ext/pdo_pgsql/tests
parent8bd8a64db64fd1bd89aa0f10b4214f576e72a8a2 (diff)
downloadphp-git-0f182c2495f3aa84aed76485a4406b383c77c785.tar.gz
Fixed bug #72570 Segmentation fault when binding parameters on a query without placeholders
Special commit for 7.0.9
Diffstat (limited to 'ext/pdo_pgsql/tests')
-rw-r--r--ext/pdo_pgsql/tests/bug72570.phpt28
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/pdo_pgsql/tests/bug72570.phpt b/ext/pdo_pgsql/tests/bug72570.phpt
new file mode 100644
index 0000000000..e52efd93bb
--- /dev/null
+++ b/ext/pdo_pgsql/tests/bug72570.phpt
@@ -0,0 +1,28 @@
+--TEST--
+PDO PgSQL Bug #72570 (Segmentation fault when binding parameters on a query without placeholders)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+
+$stmt = $db->prepare("SELECT 1");
+
+try {
+ var_dump($stmt->execute([1]));
+} catch (PDOException $e) {
+ var_dump($e->getCode());
+}
+
+?>
+--EXPECT--
+bool(false)