bug70861.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. Bug #70861 Segmentation fault in pdo_parse_params() during Drupal 8 test suite
  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_STRINGIFY_FETCHES, true);
  17. try {
  18. @$db->query("SET bytea_output = 'escape'");
  19. } catch (Exception $e) {
  20. }
  21. $db->query('DROP TABLE IF EXISTS test_blob_crash CASCADE');
  22. $db->query('CREATE TABLE test_blob_crash (id SERIAL NOT NULL, blob1 BYTEA)');
  23. class HelloWrapper {
  24. public function stream_open() { return true; }
  25. public function stream_eof() { return true; }
  26. public function stream_read() { return NULL; }
  27. public function stream_stat() { return array(); }
  28. }
  29. stream_wrapper_register("hello", "HelloWrapper");
  30. $f = fopen("hello://there", "r");
  31. $stmt = $db->prepare("INSERT INTO test_one_blob (blob1) VALUES (:foo)", array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
  32. $stmt->bindparam(':foo', $f, PDO::PARAM_LOB);
  33. $stmt->execute();
  34. fclose($f);
  35. ?>
  36. +++DONE+++
  37. --EXPECTF--
  38. %a
  39. +++DONE+++