svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/pdo/pdo_stmt.c branches/PHP_5_2/ext/pdo_mysql/tests/bug_45120.phpt branches/PHP_5_3/NEWS
branches/PHP_5_3/ext/pdo/pdo_stmt.c branches/PHP_5_3/ext/pdo_mysql/tests/bug_45120.phpt trunk/ext/pdo/pdo_stmt.c
trunk/ext/pdo_mysql/tests/bug_45120.phpt
| From: | Pierrick Charron | Date: | Thu, 03 Dec 2009 15:24:43 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/pdo/pdo_stmt.c branches/PHP_5_2/ext/pdo_mysql/tests/bug_45120.phpt branches/PHP_5_3/NEWS branches/PHP_5_3/ext/pdo/pdo_stmt.c branches/PHP_5_3/ext/pdo_mysql/tests/bug_45120.phpt trunk/ext/pdo/pdo_stmt.c trunk/ext/pdo_mysql/tests/bug_45120.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-61148@lists.php.net to get a copy of this message | ||
pierrick Thu, 03 Dec 2009 15:24:43 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291657
Log:
Fixed bug #45120 (PDOStatement->execute() returns true then false for same statement).
Bug: http://bugs.php.net/45120 (Open)
PDOStatement->execute() returns true then false for same statement
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
U php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c
A php/php-src/branches/PHP_5_2/ext/pdo_mysql/tests/bug_45120.phpt
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c
U php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/bug_45120.phpt
U php/php-src/trunk/ext/pdo/pdo_stmt.c
U php/php-src/trunk/ext/pdo_mysql/tests/bug_45120.phpt
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2009-12-03 15:14:12 UTC (rev 291656)
+++ php/php-src/branches/PHP_5_2/NEWS 2009-12-03 15:24:43 UTC (rev 291657)
@@ -14,8 +14,9 @@
- Fixed bug #49660 (libxml 2.7.3+ limits text nodes to 10MB). (Felipe)
- Fixed bug #49472 (Constants defined in Interfaces can be overridden).
(Felipe)
+- Fixed bug #45120 (PDOStatement->execute() returns true then false for same
+ statement). (Pierrick)
-
27 Nov 2009, PHP 5.2.12RC3
- Fixed break in the build chain introduced in 5.2.12RC2 (Jani)
Modified: php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c 2009-12-03 15:14:12 UTC (rev 291656)
+++ php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c 2009-12-03 15:24:43 UTC (rev 291657)
@@ -509,6 +509,7 @@
/* no changes were made */
stmt->active_query_string = stmt->query_string;
stmt->active_query_stringlen = stmt->query_stringlen;
+ ret = 1;
} else if (ret == -1) {
/* something broke */
PDO_HANDLE_STMT_ERR();
Added: php/php-src/branches/PHP_5_2/ext/pdo_mysql/tests/bug_45120.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_mysql/tests/bug_45120.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/pdo_mysql/tests/bug_45120.phpt 2009-12-03 15:24:43 UTC (rev
291657)
@@ -0,0 +1,48 @@
+--TEST--
+Bug #45120 (PDOStatement->execute() returns true then false for same statement)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip
not loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+
+function bug_45120($db) {
+
+ $stmt = $db->prepare("SELECT 1 AS 'one'");
+ if (true !== $stmt->execute())
+ printf("[001] Execute has failed: %s\n", var_export($stmt->errorInfo(), true));
+
+ $res = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($res['one'] != 1)
+ printf("[002] Wrong results: %s\n", var_export($res, true));
+
+ if (true !== $stmt->execute())
+ printf("[003] Execute has failed: %s\n", var_export($stmt->errorInfo(), true));
+
+ $res = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($res['one'] != 1)
+ printf("[004] Wrong results: %s\n", var_export($res, true));
+
+}
+
+print "Emulated Prepared Statements\n";
+$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+bug_45120($db);
+
+print "Native Prepared Statements\n";
+$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+bug_45120($db);
+
+print "done!";
+?>
+--EXPECT--
+Emulated Prepared Statements
+Native Prepared Statements
+done!
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2009-12-03 15:14:12 UTC (rev 291656)
+++ php/php-src/branches/PHP_5_3/NEWS 2009-12-03 15:24:43 UTC (rev 291657)
@@ -97,6 +97,8 @@
- Fixed bug #49244 (Floating point NaN cause garbage characters). (Sjoerd)
- Fixed bug #49224 (Compile error due to old DNS functions on AIX systems).
(Scott)
+- Fixed bug #45120 (PDOStatement->execute() returns true then false for same
+ statement). (Pierrick)
19 Nov 2009, PHP 5.3.1
Modified: php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c 2009-12-03 15:14:12 UTC (rev 291656)
+++ php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c 2009-12-03 15:24:43 UTC (rev 291657)
@@ -497,6 +497,7 @@
/* no changes were made */
stmt->active_query_string = stmt->query_string;
stmt->active_query_stringlen = stmt->query_stringlen;
+ ret = 1;
} else if (ret == -1) {
/* something broke */
PDO_HANDLE_STMT_ERR();
Modified: php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/bug_45120.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/bug_45120.phpt 2009-12-03 15:14:12 UTC (rev
291656)
+++ php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/bug_45120.phpt 2009-12-03 15:24:43 UTC (rev
291657)
@@ -42,8 +42,6 @@
print "done!";
?>
---XFAIL--
-This is an open PDO bug. It is not a PDO_MYSQL bug
--EXPECT--
Emulated Prepared Statements
Native Prepared Statements
Modified: php/php-src/trunk/ext/pdo/pdo_stmt.c
===================================================================
--- php/php-src/trunk/ext/pdo/pdo_stmt.c 2009-12-03 15:14:12 UTC (rev 291656)
+++ php/php-src/trunk/ext/pdo/pdo_stmt.c 2009-12-03 15:24:43 UTC (rev 291657)
@@ -496,6 +496,7 @@
/* no changes were made */
stmt->active_query_string = stmt->query_string;
stmt->active_query_stringlen = stmt->query_stringlen;
+ ret = 1;
} else if (ret == -1) {
/* something broke */
PDO_HANDLE_STMT_ERR();
Modified: php/php-src/trunk/ext/pdo_mysql/tests/bug_45120.phpt
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/tests/bug_45120.phpt 2009-12-03 15:14:12 UTC (rev 291656)
+++ php/php-src/trunk/ext/pdo_mysql/tests/bug_45120.phpt 2009-12-03 15:24:43 UTC (rev 291657)
@@ -42,8 +42,6 @@
print "done!";
?>
---XFAIL--
-This is an open PDO bug. It is not a PDO_MYSQL bug
--EXPECT--
Emulated Prepared Statements
Native Prepared Statements