summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-11-01 15:19:31 +0300
committerDmitry Stogov <dmitry@zend.com>2017-11-01 15:19:31 +0300
commit67d5f39a47b15e28293d9d6558b80ded049179fe (patch)
treee8f11a2a68bb06f259e8e3eeed5b102884df9fa6 /ext/oci8
parentf5664a149260ed4a83aa5cfb13ad11ed18c56af6 (diff)
downloadphp-git-67d5f39a47b15e28293d9d6558b80ded049179fe.tar.gz
Persistent resources are "thread-local".
Register persistent resources through new functions zend_register_persistent_resource()/zend_register_persistent_resource_ex().
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/oci8.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 9d65685170..20734d8f88 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2041,8 +2041,10 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
/* add to the appropriate hash */
if (connection->is_persistent) {
+#if PHP_VERSION_ID < 70300
new_le.ptr = connection;
new_le.type = le_pconnection;
+#endif
connection->used_this_request = 1;
PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection);
@@ -2053,7 +2055,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
if (OCI_G(old_oci_close_semantics)) {
GC_ADDREF(connection->id);
}
+#if PHP_VERSION_ID < 70300
zend_hash_update_mem(&EG(persistent_list), connection->hash_key, (void *)&new_le, sizeof(zend_resource));
+#else
+ zend_register_persistent_resource_ex(connection->hash_key, connection, le_pconnection);
+#endif
OCI_G(num_persistent)++;
OCI_G(num_links)++;
} else if (!exclusive) {
@@ -2874,7 +2880,9 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
{
smart_str spool_hashed_details = {0};
php_oci_spool *session_pool = NULL;
+#if PHP_VERSION_ID < 70300
zend_resource spool_le = {{0}};
+#endif
zend_resource *spool_out_le = NULL;
zend_bool iserror = 0;
zval *spool_out_zv = NULL;
@@ -2921,10 +2929,14 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
iserror = 1;
goto exit_get_spool;
}
+#if PHP_VERSION_ID < 70300
spool_le.ptr = session_pool;
spool_le.type = le_psessionpool;
PHP_OCI_REGISTER_RESOURCE(session_pool, le_psessionpool);
zend_hash_update_mem(&EG(persistent_list), session_pool->spool_hash_key, (void *)&spool_le, sizeof(zend_resource));
+#else
+ zend_register_persistent_resource_ex(session_pool->spool_hash_key, session_pool, le_psessionpool);
+#endif
} else if (spool_out_le->type == le_psessionpool &&
ZSTR_LEN(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key) == ZSTR_LEN(spool_hashed_details.s) &&
memcmp(ZSTR_VAL(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key), ZSTR_VAL(spool_hashed_details.s), ZSTR_LEN(spool_hashed_details.s)) == 0) {