Skip to content

Commit d0e515f

Browse files
committed
phpGH-13519: try out master withdrawing previous changes.
This reverts commit 5941cda.
1 parent 868f1a3 commit d0e515f

File tree

5 files changed

+17
-38
lines changed

5 files changed

+17
-38
lines changed

TSRM/TSRM.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -576,27 +576,6 @@ void ts_free_id(ts_rsrc_id id)
576576
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully freed resource id %d", id));
577577
}/*}}}*/
578578

579-
TSRM_API void ts_apply_for_id(ts_rsrc_id id, void (*cb)(void *))
580-
{
581-
int rsrc_id = TSRM_UNSHUFFLE_RSRC_ID(id);
582-
583-
tsrm_mutex_lock(tsmm_mutex);
584-
585-
if (tsrm_tls_table && resource_types_table) {
586-
for (int i = 0; i < tsrm_tls_table_size; i++) {
587-
tsrm_tls_entry *p = tsrm_tls_table[i];
588-
589-
while (p) {
590-
if (p->count > rsrc_id && p->storage[rsrc_id]) {
591-
cb(p->storage[rsrc_id]);
592-
}
593-
p = p->next;
594-
}
595-
}
596-
}
597-
598-
tsrm_mutex_unlock(tsmm_mutex);
599-
}
600579

601580
/*
602581
* Utility Functions

TSRM/TSRM.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ TSRM_API void ts_free_thread(void);
104104
/* deallocates all occurrences of a given id */
105105
TSRM_API void ts_free_id(ts_rsrc_id id);
106106

107-
/* Runs a callback on all resources of the given id.
108-
* The caller is responsible for ensuring the underlying resources don't data-race. */
109-
TSRM_API void ts_apply_for_id(ts_rsrc_id id, void (*cb)(void *));
110107

111108
/* Debug support */
112109
#define TSRM_ERROR_LEVEL_ERROR 1

Zend/zend.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -826,19 +826,13 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{
826826
}
827827
/* }}} */
828828

829-
static void executor_globals_persistent_list_dtor(void *storage)
829+
static void executor_globals_dtor(zend_executor_globals *executor_globals) /* {{{ */
830830
{
831-
zend_executor_globals *executor_globals = storage;
831+
zend_ini_dtor(executor_globals->ini_directives);
832832

833833
if (&executor_globals->persistent_list != global_persistent_list) {
834834
zend_destroy_rsrc_list(&executor_globals->persistent_list);
835835
}
836-
}
837-
838-
static void executor_globals_dtor(zend_executor_globals *executor_globals) /* {{{ */
839-
{
840-
zend_ini_dtor(executor_globals->ini_directives);
841-
842836
if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
843837
zend_hash_destroy(executor_globals->zend_constants);
844838
free(executor_globals->zend_constants);
@@ -1128,9 +1122,6 @@ void zend_shutdown(void) /* {{{ */
11281122
zend_vm_dtor();
11291123

11301124
zend_destroy_rsrc_list(&EG(persistent_list));
1131-
#ifdef ZTS
1132-
ts_apply_for_id(executor_globals_id, executor_globals_persistent_list_dtor);
1133-
#endif
11341125
zend_destroy_modules();
11351126

11361127
virtual_cwd_deactivate();

ext/odbc/php_odbc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,13 @@ static void _close_odbc_conn(zend_resource *rsrc)
168168
SQLFreeEnv(conn->henv);
169169
}
170170
efree(conn);
171-
ODBCG(num_links)--;
171+
/* See https://github.com/php/php-src/issues/12974 why we need to check the if */
172+
#ifdef ZTS
173+
if (odbc_module_entry.module_started)
174+
#endif
175+
{
176+
ODBCG(num_links)--;
177+
}
172178
}
173179
/* }}} */
174180

ext/pgsql/pgsql.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,14 @@ static void _close_pgsql_plink(zend_resource *rsrc)
315315
PQclear(res);
316316
}
317317
PQfinish(link);
318-
PGG(num_persistent)--;
319-
PGG(num_links)--;
318+
/* See https://github.com/php/php-src/issues/12974 why we need to check the if */
319+
#ifdef ZTS
320+
if (pgsql_module_entry.module_started)
321+
#endif
322+
{
323+
PGG(num_persistent)--;
324+
PGG(num_links)--;
325+
}
320326
rsrc->ptr = NULL;
321327
}
322328

0 commit comments

Comments
 (0)