Группа :: Разработка/Прочее
Пакет: php8.1
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: php-5.3.3-sapi-scandir.patch
Скачать
Скачать
--- php5-source/main/main.c.scandir 2010-08-12 11:48:19.000000000 +0000
+++ php5-source/main/main.c 2010-08-12 11:50:25.000000000 +0000
@@ -524,6 +524,8 @@
STD_PHP_INI_ENTRY("realpath_cache_size", "16K", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_size_limit, virtual_cwd_globals, cwd_globals)
STD_PHP_INI_ENTRY("realpath_cache_ttl", "120", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_ttl, virtual_cwd_globals, cwd_globals)
+ STD_PHP_INI_ENTRY("alt_sapi_config_ini_scan_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, alt_sapi_config_ini_scan_dir, php_core_globals, core_globals)
+
STD_PHP_INI_ENTRY("user_ini.filename", ".user.ini", PHP_INI_SYSTEM, OnUpdateString, user_ini_filename, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("user_ini.cache_ttl", "300", PHP_INI_SYSTEM, OnUpdateLong, user_ini_cache_ttl, php_core_globals, core_globals)
--- php-source/main/php_globals.h.scandir 2021-12-07 14:03:27.861085909 +0000
+++ php-source/main/php_globals.h 2021-12-07 14:04:59.231866473 +0000
@@ -146,6 +146,7 @@
zend_long max_input_nesting_level;
zend_long max_input_vars;
bool in_user_include;
+ char *alt_sapi_config_ini_scan_dir;
char *user_ini_filename;
zend_long user_ini_cache_ttl;
--- php5-source/sapi/cli/php_cli.c.orig 2010-08-17 14:26:39.466630168 +0400
+++ php5-source/sapi/cli/php_cli.c 2010-08-17 14:27:33.742634293 +0400
@@ -1362,7 +1362,7 @@
}
case PHP_MODE_SHOW_INI_CONFIG:
{
- zend_printf("Configuration File (php.ini) Path: %s\n", PHP_CONFIG_FILE_PATH);
+ zend_printf("Configuration File (php.ini) Path: %s%s/\n", PHP_CONFIG_FILE_PATH, sapi_module.name);
zend_printf("Loaded Configuration File: %s\n", php_ini_opened_path ? php_ini_opened_path : "(none)");
zend_printf("Scan for additional .ini files in: %s\n", *PHP_CONFIG_FILE_SCAN_DIR ? PHP_CONFIG_FILE_SCAN_DIR : "(none)");
zend_printf("Additional .ini files parsed: %s\n", php_ini_scanned_files ? php_ini_scanned_files : "(none)");
--- php5-source/ext/standard/info.c.orig 2010-08-17 14:21:47.222662336 +0400
+++ php5-source/ext/standard/info.c 2010-08-17 14:12:52.000000000 +0400
@@ -717,8 +717,9 @@
#else
php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
#endif
-
- php_info_print_table_row(2, "Configuration File (php.ini) Path", PHP_CONFIG_FILE_PATH);
+ tmp1 = emalloc(MAXPATHLEN + 5);
+ snprintf(tmp1,MAXPATHLEN + 5,"%s%s/",PHP_CONFIG_FILE_PATH, sapi_module.name);
+ php_info_print_table_row(2, "Configuration File (php.ini) Path", tmp1);
php_info_print_table_row(2, "Loaded Configuration File", php_ini_opened_path ? php_ini_opened_path : "(none)");
php_info_print_table_row(2, "Scan this dir for additional .ini files", php_ini_scanned_path ? php_ini_scanned_path : "(none)");
php_info_print_table_row(2, "Additional .ini files parsed", php_ini_scanned_files ? php_ini_scanned_files : "(none)");
--- php5-source/main/php_ini.c.scandir 2010-08-16 20:58:02.000000000 +0400
+++ php5-source/main/php_ini.c 2010-08-17 14:18:59.454622731 +0400
@@ -522,7 +522,8 @@
efree(default_location);
#else
- default_location = PHP_CONFIG_FILE_PATH;
+ default_location = (char *) emalloc(search_path_size);
+ snprintf(default_location,search_path_size,"%s%s/",PHP_CONFIG_FILE_PATH,sapi_module.name);
if (*php_ini_search_path) {
strlcat(php_ini_search_path, paths_separator, search_path_size);
}
@@ -610,9 +611,15 @@
/* Check for PHP_INI_SCAN_DIR environment variable to override/set config file scan directory */
php_ini_scanned_path = getenv("PHP_INI_SCAN_DIR");
+
+ /* If sapi is define the path to search .ini files, we must overwrite standart search path by sapi
+ * defined path. */
+ if (!sapi_module.php_ini_ignore && !php_ini_scanned_path)
+ cfg_get_string("alt_sapi_config_ini_scan_dir", &php_ini_scanned_path);
if (!php_ini_scanned_path) {
/* Or fall back using possible --with-config-file-scan-dir setting (defaults to empty string!) */
- php_ini_scanned_path = PHP_CONFIG_FILE_SCAN_DIR;
+ php_ini_scanned_path = (char *) malloc(MAXPATHLEN + 5);
+ snprintf(php_ini_scanned_path,MAXPATHLEN + 5,"%s%s/php.d/",PHP_CONFIG_FILE_PATH,sapi_module.name);
}
php_ini_scanned_path_len = strlen(php_ini_scanned_path);