bug_53280.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. --TEST--
  2. PDO_Firebird: bug 53280 segfaults if query column count is less than param count
  3. --EXTENSIONS--
  4. pdo_firebird
  5. --SKIPIF--
  6. <?php require('skipif.inc'); ?>
  7. --ENV--
  8. LSAN_OPTIONS=detect_leaks=0
  9. --FILE--
  10. <?php
  11. require("testdb.inc");
  12. $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
  13. @$dbh->exec('DROP TABLE testz');
  14. $dbh->exec('CREATE TABLE testz(A VARCHAR(30), B VARCHAR(30), C VARCHAR(30))');
  15. $dbh->exec("INSERT INTO testz VALUES ('A', 'B', 'C')");
  16. $dbh->commit();
  17. $stmt1 = "SELECT B FROM testz WHERE A = ? AND B = ?";
  18. $stmt2 = "SELECT B, C FROM testz WHERE A = ? AND B = ?";
  19. $stmth2 = $dbh->prepare($stmt2);
  20. $stmth2->execute(array('A', 'B'));
  21. $rows = $stmth2->fetchAll(); // <------ OK
  22. var_dump($rows);
  23. $stmth1 = $dbh->prepare($stmt1);
  24. $stmth1->execute(array('A', 'B'));
  25. $rows = $stmth1->fetchAll(); // <------- segfault
  26. var_dump($rows);
  27. $dbh->commit();
  28. unset($stmth1);
  29. unset($stmth2);
  30. $dbh->exec('DROP TABLE testz');
  31. unset($stmt);
  32. unset($dbh);
  33. ?>
  34. --EXPECT--
  35. array(1) {
  36. [0]=>
  37. array(4) {
  38. ["B"]=>
  39. string(1) "B"
  40. [0]=>
  41. string(1) "B"
  42. ["C"]=>
  43. string(1) "C"
  44. [1]=>
  45. string(1) "C"
  46. }
  47. }
  48. array(1) {
  49. [0]=>
  50. array(2) {
  51. ["B"]=>
  52. string(1) "B"
  53. [0]=>
  54. string(1) "B"
  55. }
  56. }