hi Stas!

php-5.5, build ts-windows-vc9-x86:
php_open_temporary_file.c, 201, error, C2065, 'tsrm_ls' : undeclared
identifier, main

On Tue, Jan 29, 2013 at 7:37 AM, Stanislav Malyshev <s...@php.net> wrote:
> Commit:    475a644bd84c071da04b4272b829a187a2c6d282
> Author:    ALeX Kazik <g...@kazik.de>         Fri, 18 Jan 2013 17:13:39 +0100
> Committer: Stanislav Malyshev <s...@php.net>      Mon, 28 Jan 2013 22:37:43 
> -0800
> Parents:   a9d013bb020591cb6306afa2748da80f68b81f56
> Branches:  PHP-5.5 master
>
> Link:       
> http://git.php.net/?p=php-src.git;a=commitdiff;h=475a644bd84c071da04b4272b829a187a2c6d282
>
> Log:
> Implemented Feature #60524 (sys_temp_dir)
>
> Added a new configuration directive which allows it to change the
> temporary directory, the default behavior is unchanged.
>
> This is a useful option if you use all/some hosts inside of one .ini file
> with sections and want to change the temp dir per user (maybe it's not
> allowed to write outside the users home directory). Since the TMPDIR
> variable affects the whole php that way can not be used for this scenario.
>
> (see https://bugs.php.net/bug.php?id=60524)
>
> Bugs:
> https://bugs.php.net/60524
>
> Changed paths:
>   M  main/main.c
>   M  main/php_globals.h
>   M  main/php_open_temporary_file.c
>   M  php.ini-development
>   M  php.ini-production
>   A  tests/basic/req60524.phpt
>
>
> Diff:
> diff --git a/main/main.c b/main/main.c
> index f87a142..325ef7e 100644
> --- a/main/main.c
> +++ b/main/main.c
> @@ -521,6 +521,7 @@ PHP_INI_BEGIN()
>         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("sys_temp_dir",                       NULL,         
>   PHP_INI_SYSTEM,         OnUpdateStringUnempty,  sys_temp_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 --git a/main/php_globals.h b/main/php_globals.h
> index 170431d..256765d 100644
> --- a/main/php_globals.h
> +++ b/main/php_globals.h
> @@ -85,6 +85,7 @@ struct _php_core_globals {
>         char *open_basedir;
>         char *extension_dir;
>         char *php_binary;
> +       char *sys_temp_dir;
>
>         char *upload_tmp_dir;
>         long upload_max_filesize;
> diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
> index b43d6a7..5d5e5b9 100644
> --- a/main/php_open_temporary_file.c
> +++ b/main/php_open_temporary_file.c
> @@ -196,6 +196,21 @@ PHPAPI const char* php_get_temporary_directory(void)
>                 return temporary_directory;
>         }
>
> +       /* Is there a temporary directory "sys_temp_dir" in .ini defined? */
> +       {
> +               char *sys_temp_dir = PG(sys_temp_dir);
> +               if (sys_temp_dir) {
> +                       int len = strlen(sys_temp_dir);
> +                       if (len >= 2 && sys_temp_dir[len - 1] == 
> DEFAULT_SLASH) {
> +                               temporary_directory = 
> zend_strndup(sys_temp_dir, len - 1);
> +                               return temporary_directory;
> +                       } else if (len >= 1 && sys_temp_dir[len - 1] != 
> DEFAULT_SLASH) {
> +                               temporary_directory = 
> zend_strndup(sys_temp_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 --git a/php.ini-development b/php.ini-development
> index a97cd0f..93a4b7d 100644
> --- a/php.ini-development
> +++ b/php.ini-development
> @@ -729,6 +729,10 @@ user_dir =
>  ; On windows:
>  ; extension_dir = "ext"
>
> +; Directory where the temporary files should be placed.
> +; Defaults to the system default (see sys_get_temp_dir)
> +; sys_temp_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 --git a/php.ini-production b/php.ini-production
> index dce8fc9..7d84c9b 100644
> --- a/php.ini-production
> +++ b/php.ini-production
> @@ -729,6 +729,10 @@ user_dir =
>  ; On windows:
>  ; extension_dir = "ext"
>
> +; Directory where the temporary files should be placed.
> +; Defaults to the system default (see sys_get_temp_dir)
> +; sys_temp_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 --git a/tests/basic/req60524.phpt b/tests/basic/req60524.phpt
> new file mode 100644
> index 0000000..6803e1f
> --- /dev/null
> +++ b/tests/basic/req60524.phpt
> @@ -0,0 +1,8 @@
> +--TEST--
> +Req #60524 (Specify temporary directory)
> +--INI--
> +sys_temp_dir=/path/to/temp/dir
> +--FILE--
> +<?php echo sys_get_temp_dir(); ?>
> +--EXPECT--
> +/path/to/temp/dir
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to