Skip to content

Add GC_PERSISTENT_LOCAL flag for ODBC structures #14094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ext/odbc/php_odbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ static PHP_GINIT_FUNCTION(odbc)
#endif
odbc_globals->num_persistent = 0;
zend_hash_init(&odbc_globals->connections, 0, NULL, NULL, true);
GC_MAKE_PERSISTENT_LOCAL(&odbc_globals->connections);
}

static PHP_GSHUTDOWN_FUNCTION(odbc)
Expand Down Expand Up @@ -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);
link->persistent = persistent;
link->hash = zend_string_init(hash, hash_len, persistent);
if (persistent) {
GC_MAKE_PERSISTENT_LOCAL(link->hash);
}
ret = SQLAllocEnv(&link->connection->henv);
if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) {
odbc_sql_error(link->connection, SQL_NULL_HSTMT, "SQLAllocEnv");
Expand Down
Loading