thetaphi Mon Apr 4 10:59:41 2005 EDT
Modified files:
/php-src NEWS
/php-src/main rfc1867.c
Log:
Bug #32491 (File upload error - unable to create a temporary file) - Changing
file upload from stdio to posix
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1863&r2=1.1864&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1863 php-src/NEWS:1.1864
--- php-src/NEWS:1.1863 Mon Apr 4 03:15:59 2005
+++ php-src/NEWS Mon Apr 4 10:59:38 2005
@@ -96,6 +96,8 @@
- Fixed bug with raw_post_data not getting set. (Brian)
- Fixed bug in mysql::client_version(). (Georg)
- Fixed ZTS destruction. (Marcus)
+- Fixed bug #32491 (File upload error - unable to create a temporary file).
+ (Uwe Schindler)
- Fixed bug #32109 ($_POST is not populated in multithreaded environment).
(Moriyoshi)
- Fixed bug #31478 (segfault with empty() / isset()). (Moriyoshi)
http://cvs.php.net/diff.php/php-src/main/rfc1867.c?r1=1.170&r2=1.171&ty=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.170 php-src/main/rfc1867.c:1.171
--- php-src/main/rfc1867.c:1.170 Mon Feb 14 19:25:38 2005
+++ php-src/main/rfc1867.c Mon Apr 4 10:59:40 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.170 2005/02/15 00:25:38 iliaa Exp $ */
+/* $Id: rfc1867.c,v 1.171 2005/04/04 14:59:40 thetaphi Exp $ */
/*
* This product includes software developed by the Apache Group
@@ -784,7 +784,7 @@
zend_bool magic_quotes_gpc;
multipart_buffer *mbuff;
zval *array_ptr = (zval *) arg;
- FILE *fp;
+ int fd=-1;
zend_llist header;
if (SG(request_info).content_length > SG(post_max_size)) {
@@ -969,8 +969,8 @@
if (!skip_upload) {
/* Handle file */
- fp =
php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC);
- if (!fp) {
+ fd = php_open_temporary_fd(PG(upload_tmp_dir),
"php", &temp_filename TSRMLS_CC);
+ if (fd==-1) {
sapi_module.sapi_error(E_WARNING, "File
upload error - unable to create a temporary file");
cancel_upload = UPLOAD_ERROR_E;
}
@@ -1001,7 +1001,7 @@
#endif
cancel_upload = UPLOAD_ERROR_B;
} else if (blen > 0) {
- wlen = fwrite(buff, 1, blen, fp);
+ wlen = write(fd, buff, blen);
if (wlen < blen) {
#if DEBUG_FILE_UPLOAD
@@ -1013,8 +1013,8 @@
}
}
}
- if (fp) { /* may not be initialized if file could not
be created */
- fclose(fp);
+ if (fd!=-1) { /* may not be initialized if file could
not be created */
+ close(fd);
}
#if DEBUG_FILE_UPLOAD
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php