Add GC_PERSISTENT_LOCAL flag for ODBC structures (#14094)

Fixes nightly builds where ZEND_RC_DEBUG is enabled
This commit is contained in:
Máté Kocsis 2024-04-30 22:30:38 +02:00 committed by GitHub
parent d3b38fa8de
commit afa034df99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -503,6 +503,7 @@ static PHP_GINIT_FUNCTION(odbc)
#endif #endif
odbc_globals->num_persistent = 0; odbc_globals->num_persistent = 0;
zend_hash_init(&odbc_globals->connections, 0, NULL, NULL, true); zend_hash_init(&odbc_globals->connections, 0, NULL, NULL, true);
GC_MAKE_PERSISTENT_LOCAL(&odbc_globals->connections);
} }
static PHP_GSHUTDOWN_FUNCTION(odbc) static PHP_GSHUTDOWN_FUNCTION(odbc)
@ -2129,6 +2130,9 @@ bool odbc_sqlconnect(zval *zv, char *db, char *uid, char *pwd, int cur_opt, bool
zend_hash_init(&link->connection->results, 0, NULL, ZVAL_PTR_DTOR, true); zend_hash_init(&link->connection->results, 0, NULL, ZVAL_PTR_DTOR, true);
link->persistent = persistent; link->persistent = persistent;
link->hash = zend_string_init(hash, hash_len, persistent); link->hash = zend_string_init(hash, hash_len, persistent);
if (persistent) {
GC_MAKE_PERSISTENT_LOCAL(link->hash);
}
ret = SQLAllocEnv(&link->connection->henv); ret = SQLAllocEnv(&link->connection->henv);
if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) { if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) {
odbc_sql_error(link->connection, SQL_NULL_HSTMT, "SQLAllocEnv"); odbc_sql_error(link->connection, SQL_NULL_HSTMT, "SQLAllocEnv");