diff options
author | Antony Dovgal <tony2001@php.net> | 2006-11-28 16:55:05 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-11-28 16:55:05 +0000 |
commit | bb30875db6025aedec2a33f88374bc4a49ab8c60 (patch) | |
tree | ab5d011f88b8609f35d5188d35147000a840eb40 /ext/pdo/tests | |
parent | 2d4b8e19e2cd9dab59188cef89fd771d7a71aa7f (diff) | |
download | php-git-bb30875db6025aedec2a33f88374bc4a49ab8c60.tar.gz |
add test
Diffstat (limited to 'ext/pdo/tests')
-rw-r--r-- | ext/pdo/tests/bug_39656.phpt | 51 |
1 files changed, 51 insertions, 0 deletions
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-- +<?php +if (!extension_loaded('pdo')) die('skip'); +$dir = getenv('REDIR_TEST_DIR'); +if (false == $dir) die('skip no driver'); +require_once $dir . 'pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php + +if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); +require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; +$db = PDOTest::factory(); + +$db->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 + |