diff options
author | Christopher Jones <christopher.jones@oracle.com> | 2018-12-07 23:20:27 +1100 |
---|---|---|
committer | Christopher Jones <christopher.jones@oracle.com> | 2018-12-07 23:20:27 +1100 |
commit | 171389b4356af4232d2825b29d63104d7db9a4b1 (patch) | |
tree | b443d47d390b7e79ca74b6aa6f2ec10fa22b9f42 /ext/oci8 | |
parent | 91776f7264dccf252e97e88d1634dc26bede21f2 (diff) | |
parent | b797818e09d3d2f7b81ca4c8c4e4bb874f623c87 (diff) | |
download | php-git-171389b4356af4232d2825b29d63104d7db9a4b1.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
Diffstat (limited to 'ext/oci8')
-rw-r--r-- | ext/oci8/oci8.c | 28 | ||||
-rw-r--r-- | ext/oci8/oci8_lob.c | 4 | ||||
-rw-r--r-- | ext/oci8/oci8_statement.c | 42 | ||||
-rw-r--r-- | ext/oci8/php_oci8_int.h | 8 |
4 files changed, 8 insertions, 74 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 25d2927c68..af1b44a458 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1455,11 +1455,7 @@ void php_oci_column_hash_dtor(zval *data) if (GC_REFCOUNT(column->descid) == 1) zend_list_close(column->descid); else { -#if PHP_VERSION_ID < 70300 - GC_REFCOUNT(column->descid)--; -#else GC_DELREF(column->descid); -#endif } } @@ -1882,11 +1878,7 @@ 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); @@ -1896,11 +1888,7 @@ 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); @@ -1911,11 +1899,7 @@ 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? */ @@ -2069,11 +2053,7 @@ 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)); @@ -2474,11 +2454,7 @@ 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) { @@ -2522,11 +2498,7 @@ 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_lob.c b/ext/oci8/oci8_lob.c index 8c7cc95ade..aaf4563cf5 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -67,11 +67,7 @@ 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 1a3a035518..68ee6b5762 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -111,11 +111,7 @@ 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)); @@ -175,13 +171,8 @@ 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); @@ -442,11 +433,7 @@ 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; @@ -608,15 +595,7 @@ 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)); @@ -1553,22 +1532,7 @@ 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 */ tmp = zval_get_long(column_index); column = php_oci_statement_get_column(statement, tmp, NULL, 0); @@ -1576,7 +1540,6 @@ 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; } @@ -1639,13 +1602,8 @@ 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); diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index 5243b663cc..577a315817 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -545,6 +545,14 @@ int php_oci_unregister_taf_callback(php_oci_connection *connection); #define OCI_G(v) (oci_globals.v) #endif +/* Allow install from PECL on PHP < 7.3 */ +#ifndef GC_ADDREF +# define GC_ADDREF(p) (++GC_REFCOUNT(p)) +#endif +#ifndef GC_DELREF +# define GC_DELREF(p) (GC_REFCOUNT(p)--) +#endif + ZEND_EXTERN_MODULE_GLOBALS(oci) # endif /* !PHP_OCI8_INT_H */ |