ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-cvs
php-cvs
[PHP-CVS] cvs: php-src /ext/pdo pdo_stmt.c /ext/pdo_pgsql pgsql_statement.c
by Ilia Alshanetsky other posts by this author
Nov 28 2006 8:28AM messages near this date
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/pdo/tests bug_39656.phpt | [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/pdo pdo_stmt.c /ext/pdo_pgsql pgsql_statement.c
iliaa		Tue Nov 28 16:28:07 2006 UTC

  Modified files:              
    /php-src/ext/pdo	pdo_stmt.c 
    /php-src/ext/pdo_pgsql	pgsql_statement.c 
  Log:
  MFB: Fixed bug #39656 (crash when calling fetch() on a PDO statment object     
  after closeCursor()).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.167&r2=1.168&diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.167 php-src/ext/pdo/pdo_stmt.c:1.168
--- php-src/ext/pdo/pdo_stmt.c:1.167	Tue Nov  7 17:57:37 2006
+++ php-src/ext/pdo/pdo_stmt.c	Tue Nov 28 16:28:07 2006
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_stmt.c,v 1.167 2006/11/07 17:57:37 iliaa Exp $ */
+/* $Id: pdo_stmt.c,v 1.168 2006/11/28 16:28:07 iliaa Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -434,7 +434,7 @@
 		if (!stmt-> executed) {
 			/* this is the first execute */
 
-			if (stmt-> dbh->alloc_own_columns) {
+			if (stmt-> dbh->alloc_own_columns && !stmt->columns) {
 				/* for "big boy" drivers, we need to allocate memory to fetch
 				 * the results into, so lets do that now */
 				ret = pdo_stmt_describe_columns(stmt TSRMLS_CC);
@@ -565,6 +565,10 @@
 static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori,
 	long offset, int do_bind TSRMLS_DC) /* {{{ */
 {
+	if (!stmt-> executed) {
+		return 0;
+	}
+
 	if (!dispatch_param_event(stmt, PDO_PARAM_EVT_FETCH_PRE TSRMLS_CC)) {
 		return 0;
 	}
@@ -1888,6 +1892,7 @@
 			}
 				
 		} while (1);
+		stmt-> executed = 0;
 		RETURN_TRUE;
 	}
 
@@ -1897,7 +1902,7 @@
 		PDO_HANDLE_STMT_ERR();
 		RETURN_FALSE;
 	}
-
+	stmt-> executed = 0;
 	RETURN_TRUE;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.41&r2=1.42&diff_f
ormat=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.41 php-src/ext/pdo_pgsql/pgsql_statement.c
:1.42
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.41	Thu Nov 16 17:34:42 2006
+++ php-src/ext/pdo_pgsql/pgsql_statement.c	Tue Nov 28 16:28:07 2006
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pgsql_statement.c,v 1.41 2006/11/16 17:34:42 iliaa Exp $ */
+/* $Id: pgsql_statement.c,v 1.42 2006/11/28 16:28:07 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -140,7 +140,7 @@
 		return 0;
 	}
 
-	if(!stmt-> executed) {
+	if (!stmt-> executed && !stmt->column_count) {
 		stmt-> column_count = (int) PQnfields(S->result);
 		S-> cols = ecalloc(stmt->column_count, sizeof(pdo_pgsql_column));
 	}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved