cvs: php-src(PHP_5_2) /ext/pdo/tests bug_39656.phpt bug_40285.phpt
| From: | Ilia Alshanetsky | Date: | Fri, 02 Feb 2007 00:00:33 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/pdo/tests bug_39656.phpt bug_40285.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-42932@lists.php.net to get a copy of this message | ||
iliaa Fri Feb 2 00:00:33 2007 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/pdo/tests bug_40285.phpt
Modified files:
/php-src/ext/pdo/tests bug_39656.phpt
Log:
Fixed test mixup
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/tests/bug_39656.phpt?r1=1.1.2.5&r2=1.1.2.6&diff_format=u
Index: php-src/ext/pdo/tests/bug_39656.phpt
diff -u php-src/ext/pdo/tests/bug_39656.phpt:1.1.2.5 php-src/ext/pdo/tests/bug_39656.phpt:1.1.2.6
--- php-src/ext/pdo/tests/bug_39656.phpt:1.1.2.5 Thu Feb 1 00:12:39 2007
+++ php-src/ext/pdo/tests/bug_39656.phpt Fri Feb 2 00:00:33 2007
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: Bug #40285 (The prepare parser goes into an infinite loop on ': or ":)
+PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statment object after closeCursor())
--SKIPIF--
<?php
if (!extension_loaded('pdo')) die('skip');
@@ -15,13 +15,36 @@
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
-$db->exec('CREATE TABLE test (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32),
field4 INT)');
+@$db->exec("DROP TABLE testtable");
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
-$s = $db->prepare("INSERT INTO test VALUES( ':id', 'name',
'section', 22)" );
-$s->execute();
+$db->exec("CREATE TABLE testtable (id INTEGER NOT NULL PRIMARY KEY, usr VARCHAR( 256 ) NOT
NULL)");
+$db->exec("INSERT INTO testtable (id, usr) 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 );
echo "Done\n";
?>
--EXPECT--
+array(4) {
+ ["id"]=>
+ string(1) "1"
+ [0]=>
+ string(1) "1"
+ ["usr"]=>
+ string(4) "user"
+ [1]=>
+ string(4) "user"
+}
+bool(false)
Done
+
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/tests/bug_40285.phpt?view=markup&rev=1.1
Index: php-src/ext/pdo/tests/bug_40285.phpt
+++ php-src/ext/pdo/tests/bug_40285.phpt