From: Antony Dovgal Date: Tue, 28 Nov 2006 16:55:05 +0000 (+0000) Subject: add test X-Git-Tag: php-5.2.1RC1~151 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb30875db6025aedec2a33f88374bc4a49ab8c60;p=php add test --- diff --git a/ext/pdo/tests/bug_39656.phpt b/ext/pdo/tests/bug_39656.phpt new file mode 100644 index 0000000000..00ae1feead --- /dev/null +++ b/ext/pdo/tests/bug_39656.phpt @@ -0,0 +1,51 @@ +--TEST-- +PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statment object after closeCursor()) +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +$db->exec("CREATE TABLE testtable (id INTEGER NOT NULL PRIMARY KEY, user VARCHAR( 256 ) NOT NULL)"); +$db->exec("INSERT INTO testtable (id, user) VALUES (1, 'user')"); + +$stmt = $db->prepare("SELECT * FROM testtable WHERE id = ?"); +$stmt->bindValue(1, 1, PDO::PARAM_INT ); +$stmt->execute(); +$row = $stmt->fetch(); +var_dump( $row ); + +$stmt->execute(); +$stmt->closeCursor(); +$row = $stmt->fetch(); // this line will crash CLI +var_dump( $row ); + +$db->exec("DROP TABLE testtable"); + +echo "Done\n"; +?> +--EXPECTF-- +array(4) { + ["id"]=> + string(1) "1" + [0]=> + string(1) "1" + ["user"]=> + string(4) "user" + [1]=> + string(4) "user" +} +bool(false) +Done +