diff options
author | Christopher Jones <sixd@php.net> | 2018-09-24 20:14:05 +1000 |
---|---|---|
committer | Christopher Jones <sixd@php.net> | 2018-09-24 20:14:05 +1000 |
commit | e6fae9e6f9559fb6a6bfb228ff68a7685971291f (patch) | |
tree | 3d4fe4a6219f68daeb4098704c689c03eb80a5a5 /ext | |
parent | 3413e7d1d86e03cbd3ce871c60402b1c7c427ade (diff) | |
parent | 4ba1fc0a1152042608b898802b9102273c0da957 (diff) | |
download | php-git-e6fae9e6f9559fb6a6bfb228ff68a7685971291f.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
Diffstat (limited to 'ext')
-rw-r--r-- | ext/oci8/oci8.c | 31 | ||||
-rw-r--r-- | ext/oci8/oci8_collection.c | 4 | ||||
-rw-r--r-- | ext/oci8/oci8_interface.c | 28 | ||||
-rw-r--r-- | ext/oci8/oci8_lob.c | 4 | ||||
-rw-r--r-- | ext/oci8/oci8_statement.c | 54 |
5 files changed, 120 insertions, 1 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 74c72d7bd9..63fb334c99 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1454,8 +1454,13 @@ void php_oci_column_hash_dtor(zval *data) if (column->descid) { if (GC_REFCOUNT(column->descid) == 1) zend_list_close(column->descid); - else + else { +#if PHP_VERSION_ID < 70300 + GC_REFCOUNT(column->descid)--; +#else GC_DELREF(column->descid); +#endif + } } if (column->data) { @@ -1877,7 +1882,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char (memcmp(ZSTR_VAL(tmp->hash_key), ZSTR_VAL(hashed_details.s), ZSTR_LEN(tmp->hash_key)) == 0)) { connection = tmp; +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(connection->id); +#else GC_ADDREF(connection->id); +#endif } } else { PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection); @@ -1887,7 +1896,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char * decremented in the persistent helper */ if (OCI_G(old_oci_close_semantics)) { +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(connection->id); +#else GC_ADDREF(connection->id); +#endif } } smart_str_free(&hashed_details); @@ -1898,7 +1911,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char } else { /* we do not ping non-persistent connections */ smart_str_free(&hashed_details); +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(connection->id); +#else GC_ADDREF(connection->id); +#endif return connection; } } /* is_open is true? */ @@ -2052,7 +2069,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char * refcount is decremented in the persistent helper */ if (OCI_G(old_oci_close_semantics)) { +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(connection->id); +#else GC_ADDREF(connection->id); +#endif } #if PHP_VERSION_ID < 70300 zend_hash_update_mem(&EG(persistent_list), connection->hash_key, (void *)&new_le, sizeof(zend_resource)); @@ -2453,7 +2474,11 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode) if (column->is_cursor) { /* REFCURSOR -> simply return the statement id */ ZVAL_RES(value, column->stmtid); +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(column->stmtid); +#else GC_ADDREF(column->stmtid); +#endif } else if (column->is_descr) { if (column->data_type != SQLT_RDD) { @@ -2497,7 +2522,11 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode) /* return the locator */ object_init_ex(value, oci_lob_class_entry_ptr); add_property_resource(value, "descriptor", column->descid); +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(column->descid); +#else GC_ADDREF(column->descid); +#endif } } else { switch (column->retcode) { diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index 0837761a4f..7ddda06bb2 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -52,7 +52,11 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch collection->connection = connection; collection->collection = NULL; +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(collection->connection->id); +#else GC_ADDREF(collection->connection->id); +#endif /* get type handle by name */ PHP_OCI_CALL_RETURN(errstatus, OCITypeByName, diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index ceeaefeb77..82cb30bfbf 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -60,17 +60,29 @@ PHP_FUNCTION(oci_register_taf_callback) if (!zend_is_callable(callback, 0, 0)) { callback_name = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name)); +#if PHP_VERSION_ID < 70300 + zend_string_release(callback_name); +#else zend_string_release_ex(callback_name, 0); +#endif RETURN_FALSE; } #else if (!zend_is_callable(callback, 0, &callback_name)) { php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name)); +#if PHP_VERSION_ID < 70300 + zend_string_release(callback_name); +#else zend_string_release_ex(callback_name, 0); +#endif RETURN_FALSE; } +#if PHP_VERSION_ID < 70300 + zend_string_release(callback_name); +#else zend_string_release_ex(callback_name, 0); #endif +#endif } PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); @@ -141,10 +153,18 @@ PHP_FUNCTION(oci_define_by_name) /* if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) { */ zvtmp = zend_string_init(name, name_len, 0); if ((define = zend_hash_add_new_ptr(statement->defines, zvtmp, define)) != NULL) { +#if PHP_VERSION_ID < 70300 + zend_string_release(zvtmp); +#else zend_string_release_ex(zvtmp, 0); +#endif } else { efree(define); +#if PHP_VERSION_ID < 70300 + zend_string_release(zvtmp); +#else zend_string_release_ex(zvtmp, 0); +#endif RETURN_FALSE; } @@ -1472,7 +1492,11 @@ PHP_FUNCTION(oci_fetch_all) zend_string *zvtmp; zvtmp = zend_string_init(columns[ i ]->name, columns[ i ]->name_len, 0); zend_symtable_update(Z_ARRVAL(row), zvtmp, &element); +#if PHP_VERSION_ID < 70300 + zend_string_release(zvtmp); +#else zend_string_release_ex(zvtmp, 0); +#endif } } @@ -1507,7 +1531,11 @@ PHP_FUNCTION(oci_fetch_all) array_init(&tmp); zvtmp = zend_string_init(columns[ i ]->name, columns[ i ]->name_len, 0); outarrs[ i ] = zend_symtable_update(Z_ARRVAL_P(array), zvtmp, &tmp); +#if PHP_VERSION_ID < 70300 + zend_string_release(zvtmp); +#else zend_string_release_ex(zvtmp, 0); +#endif } } diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index 7320bca899..1a44389951 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -67,7 +67,11 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_lon descriptor = ecalloc(1, sizeof(php_oci_descriptor)); descriptor->type = (ub4) type; descriptor->connection = connection; +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(descriptor->connection->id); +#else GC_ADDREF(descriptor->connection->id); +#endif PHP_OCI_CALL_RETURN(errstatus, OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0)); diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 469930fbb4..31b5a48cb8 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -111,7 +111,11 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char statement->impres_child_stmt = NULL; statement->impres_count = 0; statement->impres_flag = PHP_OCI_IMPRES_UNKNOWN; /* may or may not have Implicit Result Set children */ +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(statement->connection->id); +#else GC_ADDREF(statement->connection->id); +#endif if (OCI_G(default_prefetch) >= 0) { php_oci_statement_set_prefetch(statement, (ub4)OCI_G(default_prefetch)); @@ -171,8 +175,13 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement) statement2->has_descr = 0; statement2->stmttype = 0; +#if PHP_VERSION_ID < 70300 + GC_REFCOUNT(statement->id)++; + GC_REFCOUNT(statement2->connection->id)++; +#else GC_ADDREF(statement->id); GC_ADDREF(statement2->connection->id); +#endif php_oci_statement_set_prefetch(statement2, statement->prefetch_count); @@ -433,7 +442,11 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf return OCI_ERROR; } nested_stmt->parent_stmtid = outcol->statement->id; +#if PHP_VERSION_ID < 70300 + ++GC_REFCOUNT(outcol->statement->id); +#else GC_ADDREF(outcol->statement->id); +#endif outcol->nested_statement = nested_stmt; outcol->stmtid = nested_stmt->id; @@ -595,7 +608,15 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) for (counter = 1; counter <= colcount; counter++) { outcol = (php_oci_out_column *) ecalloc(1, sizeof(php_oci_out_column)); +#if PHP_VERSION_ID < 70300 + if ((outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol)) == NULL) { + FREE_HASHTABLE(statement->columns); + /* out of memory */ + return 1; + } +#else outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol); +#endif /* get column */ PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); @@ -989,7 +1010,12 @@ int php_oci_bind_post_exec(zval *data) * binds, php_oci_bind_out_callback() should have allocated a * new string that we can modify here. */ +#if PHP_VERSION_ID < 70300 + SEPARATE_STRING(zv); + Z_STR_P(zv) = zend_string_extend(Z_STR_P(zv), Z_STRLEN_P(zv)+1, 0); +#else ZVAL_NEW_STR(zv, zend_string_extend(Z_STR_P(zv), Z_STRLEN_P(zv)+1, 0)); +#endif Z_STRVAL_P(zv)[ Z_STRLEN_P(zv) ] = '\0'; } else if (Z_TYPE_P(zv) == IS_ARRAY) { int i; @@ -1252,7 +1278,11 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l zvtmp = zend_string_init(name, name_len, 0); bindp = (php_oci_bind *) ecalloc(1, sizeof(php_oci_bind)); bindp = zend_hash_update_ptr(statement->binds, zvtmp, bindp); +#if PHP_VERSION_ID < 70300 + zend_string_release(zvtmp); +#else zend_string_release_ex(zvtmp, 0); +#endif } /* Make sure the minimum of value_sz is 1 to avoid ORA-3149 @@ -1523,6 +1553,20 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME return NULL; } } else { +#if PHP_VERSION_ID < 70300 + zval tmp; + /* NB: for PHP4 compat only, it should be using 'Z' instead */ + tmp = *column_index; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0); + if (!column) { + php_error_docref(NULL, E_WARNING, "Invalid column index \"" ZEND_LONG_FMT "\"", Z_LVAL(tmp)); + zval_ptr_dtor(&tmp); + return NULL; + } + zval_ptr_dtor(&tmp); +#else zend_long tmp; /* NB: for PHP4 compat only, it should be using 'Z' instead */ @@ -1532,6 +1576,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME php_error_docref(NULL, E_WARNING, "Invalid column index \"" ZEND_LONG_FMT "\"", tmp); return NULL; } +#endif } return column; } @@ -1594,8 +1639,13 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t ZEND_ASSERT(Z_ISREF_P(var)); val = Z_REFVAL_P(var); +#if PHP_VERSION_ID < 70300 + SEPARATE_ZVAL_NOREF(val); + convert_to_array(val); +#else convert_to_array(val); SEPARATE_ARRAY(val); +#endif if (maxlength < -1) { php_error_docref(NULL, E_WARNING, "Invalid max length value (" ZEND_LONG_FMT ")", maxlength); @@ -1698,7 +1748,11 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t zvtmp = zend_string_init(name, name_len, 0); zend_hash_update_ptr(statement->binds, zvtmp, bind); +#if PHP_VERSION_ID < 70300 + zend_string_release(zvtmp); +#else zend_string_release_ex(zvtmp, 0); +#endif statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; |