Patch patch_php-5.4.3_custom-tmp-dir for Filesystem function related Bug #60524
Patch version 2012-05-10 15:25 UTC
Return to Bug #60524 |
Download this patch
Patch Revisions:
Developer: mail+bugs.php.net@kazik.de
diff -ru php-5.4.3/main/main.c php-5.4.3-patched/main/main.c
--- php-5.4.3/main/main.c 2012-05-08 07:22:56.000000000 +0200
+++ php-5.4.3-patched/main/main.c 2012-05-10 17:23:32.000000000 +0200
@@ -522,6 +522,7 @@
STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct,sapi_globals)
STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateErrorLog, error_log, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals)
+ STD_PHP_INI_ENTRY("system_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, system_tmp_dir, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("include_path", PHP_INCLUDE_PATH, PHP_INI_ALL, OnUpdateStringUnempty, include_path, php_core_globals, core_globals)
PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnUpdateTimeout)
STD_PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_ALL, OnUpdateBaseDir, open_basedir, php_core_globals, core_globals)
diff -ru php-5.4.3/main/php_globals.h php-5.4.3-patched/main/php_globals.h
--- php-5.4.3/main/php_globals.h 2012-05-08 07:22:56.000000000 +0200
+++ php-5.4.3-patched/main/php_globals.h 2012-05-10 17:23:32.000000000 +0200
@@ -85,6 +85,7 @@
char *open_basedir;
char *extension_dir;
char *php_binary;
+ char *system_tmp_dir;
char *upload_tmp_dir;
long upload_max_filesize;
diff -ru php-5.4.3/main/php_open_temporary_file.c php-5.4.3-patched/main/php_open_temporary_file.c
--- php-5.4.3/main/php_open_temporary_file.c 2012-05-08 07:22:56.000000000 +0200
+++ php-5.4.3-patched/main/php_open_temporary_file.c 2012-05-10 17:23:32.000000000 +0200
@@ -196,6 +196,21 @@
return temporary_directory;
}
+ /* Specify temporary directory by "system_tmp_dir" in .ini? */
+ {
+ char *system_tmp_dir = PG(system_tmp_dir);
+ if(system_tmp_dir){
+ int len = strlen(system_tmp_dir);
+ if (len >= 2 && system_tmp_dir[len - 1] == DEFAULT_SLASH) {
+ temporary_directory = zend_strndup(system_tmp_dir, len - 1);
+ return temporary_directory;
+ } else if (len >= 1 && system_tmp_dir[len - 1] != DEFAULT_SLASH) {
+ temporary_directory = zend_strndup(system_tmp_dir, len);
+ return temporary_directory;
+ }
+ }
+ }
+
#ifdef PHP_WIN32
/* We can't count on the environment variables TEMP or TMP,
* and so must make the Win32 API call to get the default
diff -ru php-5.4.3/php.ini-development php-5.4.3-patched/php.ini-development
--- php-5.4.3/php.ini-development 2012-05-08 07:22:56.000000000 +0200
+++ php-5.4.3-patched/php.ini-development 2012-05-10 17:23:32.000000000 +0200
@@ -729,6 +729,10 @@
; On windows:
; extension_dir = "ext"
+; Directory where the temporary files should be placed.
+; Defaults to the system defaut (see sys_get_temp_dir)
+; system_tmp_dir = "/tmp"
+
; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
diff -ru php-5.4.3/php.ini-production php-5.4.3-patched/php.ini-production
--- php-5.4.3/php.ini-production 2012-05-08 07:22:56.000000000 +0200
+++ php-5.4.3-patched/php.ini-production 2012-05-10 17:23:32.000000000 +0200
@@ -729,6 +729,10 @@
; On windows:
; extension_dir = "ext"
+; Directory where the temporary files should be placed.
+; Defaults to the system defaut (see sys_get_temp_dir)
+; system_tmp_dir = "/tmp"
+
; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
|