Skip to content

Commit 20a15ee

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix GH-12974: Apache crashes on shutdown when using pg_pconnect()
2 parents 85e5635 + 42575ac commit 20a15ee

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

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)