Skip to content

Commit b3e87b9

Browse files
committed
Fix GH-18145: basic_globals_ctor initialization
1 parent b57f425 commit b3e87b9

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

ext/standard/basic_functions.c

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -215,31 +215,16 @@ static void php_putenv_destructor(zval *zv) /* {{{ */
215215

216216
static void basic_globals_ctor(php_basic_globals *basic_globals_p) /* {{{ */
217217
{
218-
BG(umask) = -1;
219-
BG(user_tick_functions) = NULL;
220-
BG(user_filter_map) = NULL;
221-
BG(serialize_lock) = 0;
222-
223-
memset(&BG(serialize), 0, sizeof(BG(serialize)));
224-
memset(&BG(unserialize), 0, sizeof(BG(unserialize)));
225-
226-
memset(&BG(url_adapt_session_ex), 0, sizeof(BG(url_adapt_session_ex)));
227-
memset(&BG(url_adapt_output_ex), 0, sizeof(BG(url_adapt_output_ex)));
218+
memset(basic_globals_p, 0, sizeof(php_basic_globals));
228219

229-
BG(url_adapt_session_ex).type = 1;
230-
BG(url_adapt_output_ex).type = 0;
220+
basic_globals_p->umask = -1;
221+
basic_globals_p->url_adapt_session_ex.type = 1;
231222

232-
zend_hash_init(&BG(url_adapt_session_hosts_ht), 0, NULL, NULL, 1);
233-
zend_hash_init(&BG(url_adapt_output_hosts_ht), 0, NULL, NULL, 1);
234-
235-
#if defined(_REENTRANT)
236-
memset(&BG(mblen_state), 0, sizeof(BG(mblen_state)));
237-
#endif
238-
239-
BG(page_uid) = -1;
240-
BG(page_gid) = -1;
223+
zend_hash_init(&basic_globals_p->url_adapt_session_hosts_ht, 0, NULL, NULL, 1);
224+
zend_hash_init(&basic_globals_p->url_adapt_output_hosts_ht, 0, NULL, NULL, 1);
241225

242-
BG(syslog_device) = NULL;
226+
basic_globals_p->page_uid = -1;
227+
basic_globals_p->page_gid = -1;
243228
}
244229
/* }}} */
245230

0 commit comments

Comments
 (0)