[PHP-CVS] cvs: php-src /ext/pdo/tests bug_39656.phpt
by Antony Dovgal other posts by this author
Nov 28 2006 8:55AM messages near this date
[PHP-CVS] cvs: php-src /ext/simplexml simplexml.c /ext/simplexml/tests bug39662.phpt
|
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/pdo/tests bug_39656.phpt
tony2001 Tue Nov 28 16:55:26 2006 UTC
Modified files:
/php-src/ext/pdo/tests bug_39656.phpt
Log:
add test
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/tests/bug_39656.phpt?r1=1.1&r2=1.2&diff_format
=u
Index: php-src/ext/pdo/tests/bug_39656.phpt
diff -u /dev/null php-src/ext/pdo/tests/bug_39656.phpt:1.2
--- /dev/null Tue Nov 28 16:55:26 2006
+++ php-src/ext/pdo/tests/bug_39656.phpt Tue Nov 28 16:55:25 2006
@@ -0,0 +1,51 @@
+--TEST--
+PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statment object after closeCurs
or())
+--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
+
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|