Commit 97a581232fb for php
commit 97a581232fba43f7bb87eb6a9893cee4e724d930
Author: Gina Peter Banyard <girgias@php.net>
Date: Wed Oct 14 12:44:03 2026 +0100
ext/sqlite3: user zend_string* instead of char* for extension global (#24303)
This allows us to prevent a needless strlen() computation
diff --git a/ext/sqlite3/php_sqlite3.h b/ext/sqlite3/php_sqlite3.h
index 8a9cf3af159..47441619bdc 100644
--- a/ext/sqlite3/php_sqlite3.h
+++ b/ext/sqlite3/php_sqlite3.h
@@ -21,7 +21,7 @@ extern zend_module_entry sqlite3_module_entry;
#define phpext_sqlite3_ptr &sqlite3_module_entry
ZEND_BEGIN_MODULE_GLOBALS(sqlite3)
- char *extension_dir;
+ zend_string *extension_dir;
int dbconfig_defensive;
ZEND_END_MODULE_GLOBALS(sqlite3)
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index dbff6508367..3ad5a5b9a83 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -60,7 +60,7 @@ static zend_always_inline void php_sqlite3_fetch_one(int n_cols, php_sqlite3_res
/* {{{ PHP_INI */
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("sqlite3.extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateString, extension_dir, zend_sqlite3_globals, sqlite3_globals)
+ STD_PHP_INI_ENTRY("sqlite3.extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateStr, extension_dir, zend_sqlite3_globals, sqlite3_globals)
#if SQLITE_VERSION_NUMBER >= 3026000
STD_PHP_INI_BOOLEAN("sqlite3.defensive", "1", PHP_INI_USER, OnUpdateBool, dbconfig_defensive, zend_sqlite3_globals, sqlite3_globals)
#endif
@@ -415,8 +415,8 @@ PHP_METHOD(SQLite3, loadExtension)
RETURN_THROWS();
}
- extension_dir = SQLITE3G(extension_dir);
- extension_dir_len = strlen(SQLITE3G(extension_dir));
+ extension_dir = ZSTR_VAL(SQLITE3G(extension_dir));
+ extension_dir_len = ZSTR_LEN(SQLITE3G(extension_dir));
if (IS_SLASH(extension_dir[extension_dir_len-1])) {
spprintf(&lib_path, 0, "%s%s", extension_dir, extension);