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.3.8_custom-tmp-dir for Filesystem function related Bug #60524

Patch version 2011-12-14 14:34 UTC

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

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

diff -ru clean/php-5.3.8/main/main.c php-5.3.8/main/main.c
--- clean/php-5.3.8/main/main.c	2011-06-16 03:31:10.000000000 +0200
+++ php-5.3.8/main/main.c	2011-12-14 15:08:16.000000000 +0100
@@ -491,6 +491,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.3.8/main/php_globals.h php-5.3.8/main/php_globals.h
--- clean/php-5.3.8/main/php_globals.h	2011-01-01 03:19:59.000000000 +0100
+++ php-5.3.8/main/php_globals.h	2011-12-14 15:08:09.000000000 +0100
@@ -95,6 +95,7 @@
 	char *include_path;
 	char *open_basedir;
 	char *extension_dir;
+	char *system_tmp_dir;
 
 	char *upload_tmp_dir;
 	long upload_max_filesize;
diff -ru clean/php-5.3.8/main/php_open_temporary_file.c php-5.3.8/main/php_open_temporary_file.c
--- clean/php-5.3.8/main/php_open_temporary_file.c	2011-03-28 18:43:49.000000000 +0200
+++ php-5.3.8/main/php_open_temporary_file.c	2011-12-14 15:17:08.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.3.8/php.ini-development php-5.3.8/php.ini-development
--- clean/php-5.3.8/php.ini-development	2011-02-09 01:25:44.000000000 +0100
+++ php-5.3.8/php.ini-development	2011-12-14 14:01:35.000000000 +0100
@@ -808,6 +808,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.3.8/php.ini-production php-5.3.8/php.ini-production
--- clean/php-5.3.8/php.ini-production	2011-02-09 01:25:44.000000000 +0100
+++ php-5.3.8/php.ini-production	2011-12-14 14:01:36.000000000 +0100
@@ -808,6 +808,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: Sun Nov 24 00:01:27 2024 UTC