Attached is a patch and a corresponding test case for bug #42322 against
the PHP_5_3 branch. (Antony suggested I don't supply PDO patches
against HEAD.)
- Martin
Index: ext/pdo_mysql/mysql_statement.c
===================================================================
RCS file: /repository/php-src/ext/pdo_mysql/mysql_statement.c,v
retrieving revision 1.48.2.14.2.6
diff -u -u -r1.48.2.14.2.6 mysql_statement.c
--- ext/pdo_mysql/mysql_statement.c 17 May 2007 15:12:23 -0000
1.48.2.14.2.6
+++ ext/pdo_mysql/mysql_statement.c 13 Oct 2007 14:21:41 -0000
@@ -413,7 +413,6 @@
#endif
if (!S->result) {
- strcpy(stmt->error_code, "HY000");
return 0;
}
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
Index: ext/pdo_mysql/tests/bug_42322.phpt
===================================================================
RCS file: ext/pdo_mysql/tests/bug_42322.phpt
diff -N ext/pdo_mysql/tests/bug_42322.phpt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ext/pdo_mysql/tests/bug_42322.phpt 13 Oct 2007 14:21:41 -0000
@@ -0,0 +1,24 @@
+--TEST--
+PDO MySQL Bug #42322 (fetch() throws exception on INSERT statements)
+--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');
+
+$db->exec('CREATE TABLE test (id INT)');
+
+$stm = $db->prepare("INSERT INTO test VALUES (NULL)");
+$stm->execute();
+
+var_dump($stm->fetch());
+?>
+--EXPECT--
+bool(false)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php