From: Hartmut Holzgraefe Date: Sat, 6 May 2006 09:59:02 +0000 (+0000) Subject: Added php_get_tmpdir() function that returns the default directory for X-Git-Tag: BEFORE_NEW_OUTPUT_API~296 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=daa5febadf62fcd9fcdecd434bf18d824f06097a;p=php Added php_get_tmpdir() function that returns the default directory for temporary files (as requested in bug #35380) --- diff --git a/NEWS b/NEWS index 25428a3d28..f12fc06814 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,8 @@ PHP NEWS defined using reflection API. (Johannes) - Added second optional parameter to stream_context_create() to set params during context creation. (Sara) +- Added php_get_tmpdir() function that returns the default directory for + temporary files (as requested in bug #35380). (Hartmut) - Fixed bug #36630 (umask not reset at the end of the request). (Ilia) - Fixed bug #34286 (__toString() behavior is inconsistent). (Marcus) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 9b9f935f59..202234f636 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -846,6 +846,8 @@ zend_function_entry basic_functions[] = { PHP_FE(output_add_rewrite_var, NULL) PHP_FE(output_reset_rewrite_vars, NULL) + PHP_FE(php_get_tmpdir, NULL) + {NULL, NULL, NULL} }; diff --git a/ext/standard/file.c b/ext/standard/file.c index e1adbe8aa7..adf86f2cda 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2555,6 +2555,14 @@ PHP_FUNCTION(fnmatch) /* }}} */ #endif +/* {{{ proto string php_get_tmpdir() + Returns directory path used for temporary files */ +PHP_FUNCTION(php_get_tmpdir) +{ + RETURN_STRING((char *)php_get_temporary_directory(), 1); +} +/* }}} */ + /* * Local variables: * tab-width: 4 diff --git a/ext/standard/file.h b/ext/standard/file.h index 2d3afb1214..38ae583d7d 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -66,6 +66,7 @@ PHP_FUNCTION(fnmatch); #endif PHP_NAMED_FUNCTION(php_if_ftruncate); PHP_NAMED_FUNCTION(php_if_fstat); +PHP_FUNCTION(php_get_tmpdir); PHP_MINIT_FUNCTION(user_streams);