bug70313.phpt 932 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. PDO PgSQL Bug #70313 (PDO statement fails to throw exception)
  3. --EXTENSIONS--
  4. pdo
  5. pdo_pgsql
  6. --SKIPIF--
  7. <?php
  8. require __DIR__ . '/config.inc';
  9. require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
  10. PDOTest::skip();
  11. ?>
  12. --FILE--
  13. <?php
  14. require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
  15. $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
  16. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  17. $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
  18. try {
  19. $stmt = $db->prepare(");");
  20. $stmt->execute([1]);
  21. } catch (PDOException $e) {
  22. echo $e->getMessage(), "\n";
  23. }
  24. $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
  25. try {
  26. $stmt = $db->prepare(");");
  27. $stmt->execute([1]);
  28. } catch (PDOException $e) {
  29. echo $e->getMessage(), "\n";
  30. }
  31. ?>
  32. --EXPECTF--
  33. SQLSTATE[42601]: Syntax error: %A
  34. SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens