php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #60244
Patch bug_60244.patch revision 2011-11-09 03:25 UTC by bandy dot chris at gmail dot com

Patch bug_60244.patch for PostgreSQL related Bug #60244

Patch version 2011-11-09 03:25 UTC

Return to Bug #60244 | Download this patch
Patch Revisions:

Developer: bandy.chris@gmail.com

diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index e01816c..90f1800 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -2419,8 +2419,8 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
 	zval                *result, *zrow = NULL;
 	PGresult            *pgsql_result;
 	pgsql_result_handle *pg_result;
-	int             i, num_fields, pgsql_row, use_row;
-	long            row = -1;
+	int             i, num_fields, pgsql_row;
+	long            row;
 	char            *field_name;
 	zval            *ctor_params = NULL;
 	zend_class_entry *ce = NULL;
@@ -2447,13 +2447,6 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
 			return;
 		}
 	}
-	if (zrow == NULL) {
-		row = -1;
-	} else {
-		convert_to_long(zrow);
-		row = Z_LVAL_P(zrow);
-	}
-	use_row = ZEND_NUM_ARGS() > 1 && row != -1;
 
 	if (!(result_type & PGSQL_BOTH)) {
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid result type");
@@ -2464,7 +2457,9 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
 
 	pgsql_result = pg_result->result;
 
-	if (use_row) { 
+	if (zrow != NULL && ZEND_NUM_ARGS() > 1) {
+		convert_to_long(zrow);
+		row = Z_LVAL_P(zrow);
 		pgsql_row = row;
 		pg_result->row = pgsql_row;
 		if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 13:02:15 2014 UTC