diff --git a/NEWS b/NEWS index fb6c80c1200..ffa59739de1 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,9 @@ PHP NEWS . Fixed bug GH-12936 (hash() function hangs endlessly if using sha512 on strings >= 4GiB). (nielsdos) +- ODBC: + . Fix crash on Apache shutdown with persistent connections. (nielsdos) + - Opcache: . Fixed oss-fuzz #64727 (JIT undefined array key warning may overwrite DIM with NULL when DIM is the same var as result). (ilutov) @@ -58,6 +61,8 @@ PHP NEWS - PGSQL: . Fixed auto_reset_persistent handling and allow_persistent type. (David Carlier) + . Fixed bug GH-12974 (Apache crashes on shutdown when using pg_pconnect()). + (nielsdos) - PHPDBG: . Fixed bug GH-12962 (Double free of init_file in phpdbg_prompt.c). (nielsdos) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 636fb4029da..579b5e989bd 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -168,7 +168,13 @@ static void _close_odbc_conn(zend_resource *rsrc) SQLFreeEnv(conn->henv); } efree(conn); - ODBCG(num_links)--; + /* See https://github.com/php/php-src/issues/12974 why we need to check the if */ +#ifdef ZTS + if (odbc_module_entry.module_started) +#endif + { + ODBCG(num_links)--; + } } /* }}} */ diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index e0ffa886449..d11c328254a 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -315,8 +315,14 @@ static void _close_pgsql_plink(zend_resource *rsrc) PQclear(res); } PQfinish(link); - PGG(num_persistent)--; - PGG(num_links)--; + /* See https://github.com/php/php-src/issues/12974 why we need to check the if */ +#ifdef ZTS + if (pgsql_module_entry.module_started) +#endif + { + PGG(num_persistent)--; + PGG(num_links)--; + } rsrc->ptr = NULL; }