summaryrefslogtreecommitdiff
path: root/ext/pdo/tests/bug_39656.phpt
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-02-01 00:12:39 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-02-01 00:12:39 +0000
commitc219c6f4a81fffcd8498cc5ff6fb2301893ec3d8 (patch)
tree73e578e441ec78033198ba66e4e24b89e43a6a73 /ext/pdo/tests/bug_39656.phpt
parent56bb90399e474508077c8930e76b168c3779c7a1 (diff)
downloadphp-git-c219c6f4a81fffcd8498cc5ff6fb2301893ec3d8.tar.gz
Fixed bug #40285 (The PDO prepare parser goes into an infinite loop in
some instances).
Diffstat (limited to 'ext/pdo/tests/bug_39656.phpt')
-rw-r--r--ext/pdo/tests/bug_39656.phpt33
1 files changed, 5 insertions, 28 deletions
diff --git a/ext/pdo/tests/bug_39656.phpt b/ext/pdo/tests/bug_39656.phpt
index e1a283ce09..c0a5674389 100644
--- a/ext/pdo/tests/bug_39656.phpt
+++ b/ext/pdo/tests/bug_39656.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statment object after closeCursor())
+PDO Common: Bug #40285 (The prepare parser goes into an infinite loop on ': or ":)
--SKIPIF--
<?php
if (!extension_loaded('pdo')) die('skip');
@@ -15,36 +15,13 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE_
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
-@$db->exec("DROP TABLE testtable");
-$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+$db->exec('CREATE TABLE test (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32), field4 INT)');
-$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 );
+$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
+$s = $db->prepare("INSERT INTO test VALUES( ':id', 'name', 'section', 22)" );
+$s->execute();
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
-