19
19
/* $Id$ */
20
20
21
21
#include "php.h"
22
+ #include "php_open_temporary_file.h"
22
23
23
24
#include <errno.h>
24
25
#include <sys/types.h>
@@ -249,7 +250,7 @@ PHPAPI const char* php_get_temporary_directory(void)
249
250
* This function should do its best to return a file pointer to a newly created
250
251
* unique file, on every platform.
251
252
*/
252
- PHPAPI int php_open_temporary_fd_ex (const char * dir , const char * pfx , zend_string * * opened_path_p , zend_bool open_basedir_check )
253
+ PHPAPI int php_open_temporary_fd_ex (const char * dir , const char * pfx , zend_string * * opened_path_p , uint32_t flags )
253
254
{
254
255
int fd ;
255
256
const char * temp_dir ;
@@ -265,7 +266,7 @@ PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, zend_strin
265
266
def_tmp :
266
267
temp_dir = php_get_temporary_directory ();
267
268
268
- if (temp_dir && * temp_dir != '\0' && (!open_basedir_check || !php_check_open_basedir (temp_dir ))) {
269
+ if (temp_dir && * temp_dir != '\0' && (!( flags & PHP_TMP_FILE_OPEN_BASEDIR_CHECK ) || !php_check_open_basedir (temp_dir ))) {
269
270
return php_do_open_temporary_file (temp_dir , pfx , opened_path_p );
270
271
} else {
271
272
return -1 ;
@@ -276,7 +277,9 @@ PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, zend_strin
276
277
fd = php_do_open_temporary_file (dir , pfx , opened_path_p );
277
278
if (fd == -1 ) {
278
279
/* Use default temporary directory. */
279
- php_error_docref (NULL , E_NOTICE , "file created in the system's temporary directory" );
280
+ if (!(flags & PHP_TMP_FILE_SILENT )) {
281
+ php_error_docref (NULL , E_NOTICE , "file created in the system's temporary directory" );
282
+ }
280
283
goto def_tmp ;
281
284
}
282
285
return fd ;
0 commit comments