Annotation of embedaddon/php/ext/pdo_firebird/tests/bug_53280.phpt, revision 1.1.1.3

1.1       misho       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"); ?>
1.1.1.3 ! misho       5: <?php function_exists("ibase_query") or die("skip"); ?>
1.1       misho       6: --FILE--
                      7: <?php
                      8: 
                      9: require("testdb.inc");
                     10: 
                     11: $dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
                     12: $value = '2';
                     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: 
                     18: $stmt1 = "SELECT B FROM testz WHERE A = ? AND B = ?";
                     19: $stmt2 = "SELECT B, C FROM testz WHERE A = ? AND B = ?";
                     20: 
                     21: $stmth2 = $dbh->prepare($stmt2);
                     22: $stmth2->execute(array('A', 'B'));
                     23: $rows = $stmth2->fetchAll(); // <------ OK
                     24: var_dump($rows);
                     25: 
                     26: $stmth1 = $dbh->prepare($stmt1);
                     27: $stmth1->execute(array('A', 'B'));
                     28: $rows = $stmth1->fetchAll(); // <------- segfault
                     29: var_dump($rows);
                     30: 
                     31: $dbh->commit();
1.1.1.2   misho      32: unset($stmth1);
                     33: unset($stmth2);
1.1       misho      34: 
                     35: $dbh->exec('DROP TABLE testz');
                     36: 
                     37: unset($stmt);
                     38: unset($dbh);
                     39: 
                     40: ?>
                     41: --EXPECT--
                     42: array(1) {
                     43:   [0]=>
                     44:   array(4) {
                     45:     ["B"]=>
                     46:     string(1) "B"
                     47:     [0]=>
                     48:     string(1) "B"
                     49:     ["C"]=>
                     50:     string(1) "C"
                     51:     [1]=>
                     52:     string(1) "C"
                     53:   }
                     54: }
                     55: array(1) {
                     56:   [0]=>
                     57:   array(2) {
                     58:     ["B"]=>
                     59:     string(1) "B"
                     60:     [0]=>
                     61:     string(1) "B"
                     62:   }
                     63: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>