我已经找到了修复它的方法。那是我的补丁代码:
*** main/php_open_temporary_file.c.orig 2013-01-11 20:33:42.000000000 +0400
--- main/php_open_temporary_file.c 2013-01-11 21:17:44.000000000 +0400
***************
*** 101,113 ****
char cwd[MAXPATHLEN];
cwd_state new_state;
int fd = -1;
! #ifndef HAVE_MKSTEMP
! int open_flags = O_CREAT | O_TRUNC | O_RDWR
! #ifdef PHP_WIN32
! | _O_BINARY
! #endif
! ;
! #endif
if (!path || !path[0]) {
return -1;
--- 101,107 ----
char cwd[MAXPATHLEN];
cwd_state new_state;
int fd = -1;
! int open_flags = O_CREAT | O_TRUNC | O_RDWR;
if (!path || !path[0]) {
return -1;
***************
*** 144,169 ****
return -1;
}
- #ifdef PHP_WIN32
-
- if (GetTempFileName(new_state.cwd, pfx, 0, opened_path)) {
- /* Some versions of windows set the temp file to be read-only,
- * which means that opening it will fail... */
- if (VCWD_CHMOD(opened_path, 0600)) {
- efree(opened_path);
- free(new_state.cwd);
- return -1;
- }
- fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600);
- }
-
- #elif defined(HAVE_MKSTEMP)
- fd = mkstemp(opened_path);
- #else
if (mktemp(opened_path)) {
! fd = VCWD_OPEN(opened_path, open_flags);
}
- #endif
if (fd == -1 || !opened_path_p) {
efree(opened_path);
--- 138,146 ----
return -1;
}
if (mktemp(opened_path)) {
! fd = VCWD_OPEN_MODE(opened_path, open_flags, 0660);
}
if (fd == -1 || !opened_path_p) {
efree(opened_path);
现在它工作正常,但显示警告“警告:move_uploaded_file():第 111 行的 /path/to/script.php 中不允许操作”。如何抑制这个警告 - 我不知道。