Skip to content

Commit

Permalink
Fixed few ext/oci8 bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Sep 20, 2017
1 parent 9641586 commit 9a01fe7
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 81 deletions.
10 changes: 6 additions & 4 deletions ext/oci8/oci8.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,8 @@ void php_oci_define_hash_dtor(zval *data)
define->name = NULL;
}

zval_ptr_dtor(&define->val);

efree(define);
}
/* }}} */
Expand All @@ -1414,9 +1416,9 @@ void php_oci_bind_hash_dtor(zval *data)
{
php_oci_bind *bind = (php_oci_bind *) Z_PTR_P(data);

if (!Z_ISUNDEF(bind->parameter)) {
zval_ptr_dtor(&bind->parameter);
ZVAL_UNDEF(&bind->parameter);
if (!Z_ISUNDEF(bind->val)) {
zval_ptr_dtor(&bind->val);
ZVAL_UNDEF(&bind->val);
}

if (bind->array.elements) {
Expand Down Expand Up @@ -2642,7 +2644,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
if (placeholder == NULL) {
placeholder = return_value;
} else {
zval_dtor(placeholder);
zval_ptr_dtor(placeholder);
}

array_init(placeholder);
Expand Down
8 changes: 4 additions & 4 deletions ext/oci8/oci8_failover.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ sb4 callback_fn(void *svchp, void *envhp, void *fo_ctx, ub4 fo_type, ub4 fo_even
ZVAL_NULL(&params[0]);

/* Cleanup */
zval_dtor(&retval);
zval_dtor(&params[0]);
zval_dtor(&params[1]);
zval_dtor(&params[2]);
zval_ptr_dtor(&retval);
zval_ptr_dtor(&params[0]);
zval_ptr_dtor(&params[1]);
zval_ptr_dtor(&params[2]);

return returnValue;
}
Expand Down
9 changes: 5 additions & 4 deletions ext/oci8/oci8_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ PHP_FUNCTION(oci_define_by_name)
php_oci_define *define;
zend_string *zvtmp;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz/|l", &stmt, &name, &name_len, &var, &type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|l", &stmt, &name, &name_len, &var, &type) == FAILURE) {
return;
}

Expand Down Expand Up @@ -153,7 +153,8 @@ PHP_FUNCTION(oci_define_by_name)
define->name[name_len] = '\0';
define->name_len = (ub4) name_len;
define->type = (ub4) type;
define->zval = var;
ZEND_ASSERT(Z_ISREF_P(var));
ZVAL_COPY(&define->val, var);

RETURN_TRUE;
}
Expand Down Expand Up @@ -202,7 +203,7 @@ PHP_FUNCTION(oci_bind_array_by_name)
zval *bind_var = NULL;
php_oci_statement *statement;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz/l|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rszl|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) {
return;
}

Expand Down Expand Up @@ -1439,7 +1440,7 @@ PHP_FUNCTION(oci_fetch_all)

PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);

zval_dtor(array);
zval_ptr_dtor(array);

while (skip--) {
if (php_oci_statement_fetch(statement, nrows)) {
Expand Down

0 comments on commit 9a01fe7

Please sign in to comment.