bug_61755.phpt 966 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Bug #61755 (A parsing bug in the prepared statements can lead to access violations)
  3. --EXTENSIONS--
  4. pdo
  5. pdo_mysql
  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. echo "NULL-Byte before first placeholder:\n";
  18. $s = $db->prepare("SELECT \"a\0b\", ?");
  19. $s->bindValue(1,"c");
  20. $s->execute();
  21. $r = $s->fetch();
  22. echo "Length of item 0: ".strlen($r[0]).", Value of item 1: ".$r[1]."\n";
  23. echo "\nOpen comment:\n";
  24. try {
  25. $s = $db->prepare("SELECT /*");
  26. $s->execute();
  27. } catch (Exception $e) {
  28. echo "Error code: ".$e->getCode()."\n";
  29. }
  30. echo "\ndone!\n";
  31. ?>
  32. --EXPECT--
  33. NULL-Byte before first placeholder:
  34. Length of item 0: 3, Value of item 1: c
  35. Open comment:
  36. Error code: 42000
  37. done!