Merge branch 'PHP-5.5' into PHP-5.6

* PHP-5.5:
  Fix for #66048
This commit is contained in:
Julien Pauli 2015-05-12 16:12:51 +02:00
commit 2ddb560c2e
2 changed files with 11 additions and 11 deletions

View File

@ -1868,7 +1868,7 @@ void php_request_shutdown(void *dummy)
}
} zend_end_try();
/* 7.5 free last error information */
/* 7.5 free last error information and temp dir */
if (PG(last_error_message)) {
free(PG(last_error_message));
PG(last_error_message) = NULL;
@ -1877,6 +1877,7 @@ void php_request_shutdown(void *dummy)
free(PG(last_error_file));
PG(last_error_file) = NULL;
}
php_shutdown_temporary_directory();
/* 7. Shutdown scanner/executor/compiler and restore ini entries */
zend_deactivate(TSRMLS_C);
@ -2475,7 +2476,6 @@ void php_module_shutdown(TSRMLS_D)
#endif
php_output_shutdown();
php_shutdown_temporary_directory();
module_initialized = 0;

View File

@ -181,7 +181,7 @@ static char* temporary_directory;
PHPAPI void php_shutdown_temporary_directory(void)
{
if (temporary_directory) {
free(temporary_directory);
efree(temporary_directory);
temporary_directory = NULL;
}
}
@ -202,10 +202,10 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D)
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);
temporary_directory = estrndup(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);
temporary_directory = estrndup(sys_temp_dir, len);
return temporary_directory;
}
}
@ -222,9 +222,9 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D)
DWORD len = GetTempPath(sizeof(sTemp),sTemp);
assert(0 < len); /* should *never* fail! */
if (sTemp[len - 1] == DEFAULT_SLASH) {
temporary_directory = zend_strndup(sTemp, len - 1);
temporary_directory = estrndup(sTemp, len - 1);
} else {
temporary_directory = zend_strndup(sTemp, len);
temporary_directory = estrndup(sTemp, len);
}
return temporary_directory;
}
@ -236,9 +236,9 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D)
int len = strlen(s);
if (s[len - 1] == DEFAULT_SLASH) {
temporary_directory = zend_strndup(s, len - 1);
temporary_directory = estrndup(s, len - 1);
} else {
temporary_directory = zend_strndup(s, len);
temporary_directory = estrndup(s, len);
}
return temporary_directory;
@ -247,12 +247,12 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D)
#ifdef P_tmpdir
/* Use the standard default temporary directory. */
if (P_tmpdir) {
temporary_directory = strdup(P_tmpdir);
temporary_directory = estrdup(P_tmpdir);
return temporary_directory;
}
#endif
/* Shouldn't ever(!) end up here ... last ditch default. */
temporary_directory = strdup("/tmp");
temporary_directory = estrndup("/tmp", sizeof("/tmp"));
return temporary_directory;
#endif
}