Browse Source

@- OCIResult() could return garbage if called on empty result-sets. (thies)

# fix #19364
migration/unlabaled-1.1.2
Thies C. Arntzen 24 years ago
parent
commit
b905e40e92
  1. 9
      ext/oci8/oci8.c
  2. 1
      ext/oci8/php_oci8.h

9
ext/oci8/oci8.c

@ -1244,7 +1244,7 @@ _oci_make_zval(zval *value,oci_statement *statement,oci_out_column *column, char
oci_debug("_oci_make_zval: %16s,retlen = %4d,retlen4 = %d,storage_size4 = %4d,indicator %4d, retcode = %4d",
column->name,column->retlen,column->retlen4,column->storage_size4,column->indicator,column->retcode);
if (column->indicator == -1) { /* column is NULL */
if ((! statement->has_data) || (column->indicator == -1)) { /* column is NULL or statment has no current data */
ZVAL_NULL(value);
return 0;
}
@ -1392,7 +1392,9 @@ static oci_statement *oci_parse(oci_connection *connection, char *query, int len
if (query) {
statement->last_query = estrdup(query);
}
statement->conn = connection;
statement->has_data = 0;
statement->id = zend_list_insert(statement,le_stmt);
@ -1769,6 +1771,7 @@ oci_fetch(oci_statement *statement, ub4 nrows, char *func TSRMLS_DC)
}
statement->error = 0; /* OCI_NO_DATA is NO error for us!!! */
statement->has_data = 0;
return 0;
}
@ -1828,12 +1831,16 @@ oci_fetch(oci_statement *statement, ub4 nrows, char *func TSRMLS_DC)
_oci_make_zval(column->define->zval,statement,column,"OCIFetch",0 TSRMLS_CC);
}
statement->has_data = 1;
return 1;
}
oci_error(statement->pError, func, statement->error);
oci_handle_error(statement->conn, statement->error);
statement->has_data = 0;
return 0;
}

1
ext/oci8/php_oci8.h

@ -119,6 +119,7 @@ typedef struct {
HashTable *defines;
int ncolumns;
int executed;
int has_data;
ub2 stmttype;
} oci_statement;

Loading…
Cancel
Save