From: Zeev Suraski Date: Sun, 2 Apr 2000 21:27:32 +0000 (+0000) Subject: @- Add $HTTP_POST_FILES[filename][tmp_name] - it was previously impossible to X-Git-Tag: php-4.0RC2~513 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18e0850ba17c49de4df15463221fe06027eef01a;p=php @- Add $HTTP_POST_FILES[filename][tmp_name] - it was previously impossible to @ retrieve the temporary name of an uploaded file using $HTTP_POST_FILES[] (Zeev) - Changed IMAP Win32 definitions --- diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 839e2e2b53..4ef90a4dc7 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -41,7 +41,7 @@ ZEND_DECLARE_MODULE_GLOBALS(imap) #include #include #include -#if (WIN32|WINNT) +#ifdef PHP_WIN32 #include "winsock.h" MAILSTREAM DEFAULTPROTO; #endif @@ -130,7 +130,7 @@ function_entry imap_functions[] = { PHP_FE(imap_alerts, NULL) PHP_FE(imap_errors, NULL) PHP_FE(imap_last_error, NULL) -#if !(WIN32|WINNT) +#ifndef PHP_WIN32 PHP_FE(imap_mail, NULL) #endif PHP_FE(imap_search, NULL) @@ -380,20 +380,20 @@ PHP_MINIT_FUNCTION(imap) ZEND_INIT_MODULE_GLOBALS(imap, php_imap_init_globals, NULL) -#if !(WIN32|WINNT) +#ifndef PHP_WIN32 mail_link(&unixdriver); /* link in the unix driver */ #endif mail_link(&imapdriver); /* link in the imap driver */ mail_link(&nntpdriver); /* link in the nntp driver */ mail_link(&pop3driver); /* link in the pop3 driver */ -#if !(WIN32|WINNT) +#ifndef PHP_WIN32 mail_link(&mhdriver); /* link in the mh driver */ mail_link(&mxdriver); /* link in the mx driver */ #endif mail_link(&mbxdriver); /* link in the mbx driver */ mail_link(&tenexdriver); /* link in the tenex driver */ mail_link(&mtxdriver); /* link in the mtx driver */ -#if !(WIN32|WINNT) +#ifndef PHP_WIN32 mail_link(&mmdfdriver); /* link in the mmdf driver */ mail_link(&newsdriver); /* link in the news driver */ mail_link(&philedriver); /* link in the phile driver */ @@ -3130,7 +3130,7 @@ PHP_FUNCTION(imap_mail_compose) } /* }}} */ -#if !(WIN32|WINNT) +#ifndef PHP_WIN32 int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath) { #ifdef PHP_WIN32 diff --git a/main/rfc1867.c b/main/rfc1867.c index bca099689d..e43aeecc9a 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -30,6 +30,9 @@ #define NEW_BOUNDARY_CHECK 1 #define SAFE_RETURN { if (namebuf) efree(namebuf); if (filenamebuf) efree(filenamebuf); if (lbuf) efree(lbuf); return; } +/* The longest property name we use in an uploaded file array */ +#define MAX_SIZE_OF_INDEX sizeof("[tmpname]") + static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files ELS_DC PLS_DC) { @@ -126,7 +129,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr) if (lbuf) { efree(lbuf); } - lbuf = emalloc(s-name + MAX(MAX(sizeof("[name]"),sizeof("[size]")),sizeof("[type]"))); + lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX); state = 2; loc2 = memchr(loc + 1, '\n', rem); rem -= (loc2 - ptr) + 1; @@ -267,6 +270,10 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr) } } php_register_variable(namebuf, fn, NULL ELS_CC PLS_CC); + + /* Add $foo[tmp_name] */ + sprintf(lbuf, "%s[tmp_name]", namebuf); + register_http_post_files_variable(lbuf, fn, http_post_files ELS_CC PLS_CC); { zval file_size;