summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2005-11-06 11:58:34 +0000
committerMarcus Boerger <helly@php.net>2005-11-06 11:58:34 +0000
commit71ad4dd19ba155430fcea2984c9b7222df8958bf (patch)
tree4fc912c939aa1691072bef1387f9cd7d77fdad8a /ext/pgsql/pgsql.c
parent15c1b8a3a2b869972eb2dcdb6f80dfa526eeb362 (diff)
downloadphp-git-71ad4dd19ba155430fcea2984c9b7222df8958bf.tar.gz
- Fix parameter parsing
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 6802e87329..96f551f4f7 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1872,7 +1872,7 @@ PHP_FUNCTION(pg_fetch_result)
/* {{{ void php_pgsql_fetch_hash */
static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, int into_object)
{
- zval *result;
+ zval *result, *zrow = NULL;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
int i, num_fields, pgsql_row, use_row;
@@ -1886,7 +1886,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
char *class_name;
int class_name_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lsz", &result, &row, &class_name, &class_name_len, &ctor_params) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!sz", &result, &zrow, &class_name, &class_name_len, &ctor_params) == FAILURE) {
return;
}
if (ZEND_NUM_ARGS() < 3) {
@@ -1900,10 +1900,16 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
}
result_type = PGSQL_ASSOC;
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &result, &row, &result_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!l", &result, &zrow, &result_type) == FAILURE) {
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)) {