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

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"); ?>
                      5: --FILE--
                      6: <?php
                      7: 
                      8: require("testdb.inc");
                      9: 
                     10: $dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
                     11: $value = '2';
                     12: @$dbh->exec('DROP TABLE testz');
                     13: $dbh->exec('CREATE TABLE testz(A VARCHAR(30), B VARCHAR(30), C VARCHAR(30))');
                     14: $dbh->exec("INSERT INTO testz VALUES ('A', 'B', 'C')");
                     15: $dbh->commit();
                     16: 
                     17: $stmt1 = "SELECT B FROM testz WHERE A = ? AND B = ?";
                     18: $stmt2 = "SELECT B, C FROM testz WHERE A = ? AND B = ?";
                     19: 
                     20: $stmth2 = $dbh->prepare($stmt2);
                     21: $stmth2->execute(array('A', 'B'));
                     22: $rows = $stmth2->fetchAll(); // <------ OK
                     23: var_dump($rows);
                     24: 
                     25: $stmth1 = $dbh->prepare($stmt1);
                     26: $stmth1->execute(array('A', 'B'));
                     27: $rows = $stmth1->fetchAll(); // <------- segfault
                     28: var_dump($rows);
                     29: 
                     30: $stmt = $dbh->prepare('DELETE FROM testz');
                     31: $stmt->execute();
                     32: 
                     33: $dbh->commit();
                     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>