php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #60524
Patch patch_php-5.4.3_custom-tmp-dir revision 2012-05-10 15:25 UTC by mail+bugs dot php dot net at kazik dot de
Patch patch_php-5.4.0_custom-tmp-dir revision 2012-03-13 15:59 UTC by mail+bugs dot php dot net at kazik dot de
Patch patch_php-5.3.8_custom-tmp-dir revision 2011-12-14 14:34 UTC by mail+bugs dot php dot net at kazik dot de

Patch patch_php-5.4.0_custom-tmp-dir for Filesystem function related Bug #60524

Patch version 2012-03-13 15:59 UTC

Return to Bug #60524 | Download this patch
Patch Revisions:

Developer: mail+bugs.php.net@kazik.de

diff -ru clean/php-5.4.0/main/main.c php-5.4.0/main/main.c
--- clean/php-5.4.0/main/main.c	2012-02-16 02:51:45.000000000 +0100
+++ php-5.4.0/main/main.c	2012-03-05 12:19:53.000000000 +0100
@@ -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 clean/php-5.4.0/main/php_globals.h php-5.4.0/main/php_globals.h
--- clean/php-5.4.0/main/php_globals.h	2012-01-01 14:15:04.000000000 +0100
+++ php-5.4.0/main/php_globals.h	2012-03-05 12:21:45.000000000 +0100
@@ -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 clean/php-5.4.0/main/php_open_temporary_file.c php-5.4.0/main/php_open_temporary_file.c
--- clean/php-5.4.0/main/php_open_temporary_file.c	2012-01-01 14:15:04.000000000 +0100
+++ php-5.4.0/main/php_open_temporary_file.c	2012-03-05 12:19:53.000000000 +0100
@@ -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 clean/php-5.4.0/php.ini-development php-5.4.0/php.ini-development
--- clean/php-5.4.0/php.ini-development	2012-02-08 21:12:44.000000000 +0100
+++ php-5.4.0/php.ini-development	2012-03-05 12:19:53.000000000 +0100
@@ -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 clean/php-5.4.0/php.ini-production php-5.4.0/php.ini-production
--- clean/php-5.4.0/php.ini-production	2012-02-08 21:12:44.000000000 +0100
+++ php-5.4.0/php.ini-production	2012-03-05 12:19:53.000000000 +0100
@@ -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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC