bug_53280.phpt 1.2 KB

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