iliaa           Thu Nov  3 10:57:08 2005 EDT

  Modified files:              (Branch: PHP_4_4)
    /php-src    NEWS 
    /php-src/ext/imap   php_imap.c 
  Log:
  Syncornize code with CS/error handling from 5.X
  MFH crash fixes for imap_mailcompose function.
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.920.2.68&r2=1.1247.2.920.2.69&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.68 php-src/NEWS:1.1247.2.920.2.69
--- php-src/NEWS:1.1247.2.920.2.68      Thu Nov  3 09:58:38 2005
+++ php-src/NEWS        Thu Nov  3 10:57:00 2005
@@ -1,6 +1,7 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, Version 4.4.2
+- Backport missing imap_mailcompose fixes from 5.X. (Ilia)
 - Missing safe_mode/open_basedir check in cURL extension. (Ilia)
 - Fixed bug #35067, #35063 (key(),current() need to work by reference). (Ilia)
 - Fixed bug #35059 (Apache2 crash with mod_rewrite). (Ilia)
http://cvs.php.net/diff.php/php-src/ext/imap/php_imap.c?r1=1.142.2.44&r2=1.142.2.44.2.1&ty=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.142.2.44 
php-src/ext/imap/php_imap.c:1.142.2.44.2.1
--- php-src/ext/imap/php_imap.c:1.142.2.44      Fri Apr  8 11:04:52 2005
+++ php-src/ext/imap/php_imap.c Thu Nov  3 10:57:04 2005
@@ -26,7 +26,7 @@
    | PHP 4.0 updates:  Zeev Suraski <[EMAIL PROTECTED]>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_imap.c,v 1.142.2.44 2005/04/08 15:04:52 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.142.2.44.2.1 2005/11/03 15:57:04 iliaa Exp $ */
 
 #define IMAP41
 
@@ -51,7 +51,7 @@
 #include <signal.h>
 
 #ifdef PHP_WIN32
-#include <winsock.h>
+#include <winsock2.h>
 #include <stdlib.h>
 #include "win32/sendmail.h"
 MAILSTREAM DEFAULTPROTO;
@@ -348,21 +348,15 @@
 
 void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
 {
-       zval *t_map;
-       zval *return_value;
+       zval *t_map, *return_value;
        TSRMLS_FETCH();
-
-       return_value = *IMAPG(quota_return);
        
+       return_value = *IMAPG(quota_return);
+
 /* put parsing code here */
        for(; qlist; qlist = qlist->next) {
                MAKE_STD_ZVAL(t_map);
-               if (array_init(t_map) == FAILURE) {
-                       php_error(E_WARNING, "Unable to allocate t_map memory");
-                       FREE_ZVAL(t_map);
-                       FREE_ZVAL(IMAPG(quota_return));
-                       return;
-               }
+               array_init(t_map);
                if (strncmp(qlist->name, "STORAGE", 7) == 0)
                {
                        /* this is to add backwards compatibility */
@@ -652,7 +646,7 @@
                if (EG(error_reporting) & E_NOTICE) {
                        ecur = IMAPG(imap_errorstack);
                        while (ecur != NIL) {
-                               php_error(E_NOTICE, "%s(): %s (errflg=%ld)", 
get_active_function_name(TSRMLS_C), ecur->LTEXT, ecur->errflg);
+                               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s 
(errflg=%ld)", ecur->LTEXT, ecur->errflg);
                                ecur = ecur->next;
                        }
                }
@@ -664,7 +658,7 @@
                if (EG(error_reporting) & E_NOTICE) {
                        acur = IMAPG(imap_alertstack);
                        while (acur != NIL) {
-                               php_error(E_NOTICE, "%s(): %s", 
get_active_function_name(TSRMLS_C), acur->LTEXT);
+                               php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
"%s", acur->LTEXT);
                                acur = acur->next;
                        }
                }
@@ -743,7 +737,7 @@
        imap_stream = mail_open(NIL, Z_STRVAL_PP(mailbox), flags);
 
        if (imap_stream == NIL) {
-               php_error(E_WARNING, "%s(): Couldn't open stream %s", 
get_active_function_name(TSRMLS_C), Z_STRVAL_PP(mailbox));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't open 
stream %s", Z_STRVAL_PP(mailbox));
                efree(IMAPG(imap_user)); IMAPG(imap_user) = 0;
                efree(IMAPG(imap_password)); IMAPG(imap_password) = 0;
                RETURN_FALSE;
@@ -795,7 +789,7 @@
        }
        imap_stream = mail_open(imap_le_struct->imap_stream, 
Z_STRVAL_PP(mailbox), flags);
        if (imap_stream == NIL) {
-               php_error(E_WARNING, "%s(): Couldn't re-open stream", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't re-open 
stream");
                RETURN_FALSE;
        }
        imap_le_struct->imap_stream = imap_stream;
@@ -903,7 +897,7 @@
        convert_to_string_ex(qroot);
 
        array_init(return_value);
-       IMAPG(quota_return) = &return_value;
+       IMAPG(quota_return) = &return_value;
 
        /* set the callback for the GET_QUOTA function */
        mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
@@ -1060,9 +1054,7 @@
        ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", 
le_imap);
 
        /* Initialize return array */
-       if (array_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       array_init(return_value);
        
        for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) {
                MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream, 
msgno);
@@ -1122,7 +1114,7 @@
                msgindex = Z_LVAL_PP(msgno);
        }
        if ((msgindex < 1) || ((unsigned) msgindex > 
imap_le_struct->imap_stream->nmsgs)) {
-               php_error(E_WARNING, "%s(): Bad message number", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message 
number");
                RETURN_FALSE;
        }
 
@@ -1481,7 +1473,7 @@
 
        convert_to_long_ex(msgno);
        if (myargc >= 3) {
-               convert_to_long_ex(fromlength); 
+               convert_to_long_ex(fromlength);
                if (Z_LVAL_PP(fromlength) < 0) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "From 
length has to be greater than or equal to 0");
                        RETURN_FALSE;
@@ -1503,7 +1495,7 @@
        }
        
        PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
-       
+
        if (mail_fetchstructure(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), 
NIL)) {
                cache = mail_elt(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
        } else {
@@ -1636,9 +1628,7 @@
 
        convert_to_string_ex(ref);
        convert_to_string_ex(pat);
-       
-       delim = emalloc(2 * sizeof(char));
-       
+
        /* set flag for new, improved array of objects list */
        IMAPG(folderlist_style) = FLIST_OBJECT;
        
@@ -1751,13 +1741,12 @@
        } else {
                msgindex = Z_LVAL_PP(msgno);
        }
-
        PHP_IMAP_CHECK_MSGNO(msgindex);
 
        mail_fetchstructure_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), 
&body , myargc == 3 ? Z_LVAL_PP(flags) : NIL);
        
        if (!body) {
-               php_error(E_WARNING, "%s(): No body information available", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "No body 
information available");
                RETURN_FALSE;
        }
        
@@ -1795,7 +1784,7 @@
        body = mail_fetchbody_full(imap_le_struct->imap_stream, 
Z_LVAL_PP(msgno), Z_STRVAL_PP(sec), &len, myargc==4 ? Z_LVAL_PP(flags) : NIL);
 
        if (!body) {
-               php_error(E_WARNING, "%s(): No body information available", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "No body 
information available");
                RETURN_FALSE;
        }
        RETVAL_STRINGL(body, len, 1);
@@ -1919,9 +1908,7 @@
        ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", 
le_imap);
 
        /* Initialize return object */
-       if (object_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       object_init(return_value);
 
        unreadmsg = 0;
        deletedmsg = 0;
@@ -2016,9 +2003,7 @@
 
        rfc822_parse_adrlist(&env->to, Z_STRVAL_PP(str), 
Z_STRVAL_PP(defaulthost));
 
-       if (array_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        addresstmp = env->to;
 
@@ -2109,7 +2094,9 @@
                ZEND_WRONG_PARAM_COUNT();
        }
        
-       convert_to_writable_string_ex(arg);             /* Is this string 
really modified? */
+       convert_to_string_ex(arg);              /*      Is this string really 
modified?
+                                                                               
If it is use and you don't want it to be seen outside of the function
+                                                                               
then use zend_get_parameters() */
 
        in = (const unsigned char *) Z_STRVAL_PP(arg);
        inlen = Z_STRLEN_PP(arg);
@@ -2121,12 +2108,12 @@
                if (state == ST_NORMAL) {
                        /* process printable character */
                        if (SPECIAL(*inp)) {
-                               php_error(E_WARNING, "%s(): Invalid modified 
UTF-7 character: `%c'", get_active_function_name(TSRMLS_C), *inp);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Invalid modified UTF-7 character: `%c'", *inp);
                                RETURN_FALSE;
                        } else if (*inp != '&') {
                                outlen++;
                        } else if (inp + 1 == endp) {
-                               php_error(E_WARNING, "%s(): Unexpected end of 
string", get_active_function_name(TSRMLS_C));
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Unexpected end of string");
                                RETURN_FALSE;
                        } else if (inp[1] != '-') {
                                state = ST_DECODE0;
@@ -2137,12 +2124,12 @@
                } else if (*inp == '-') {
                        /* return to NORMAL mode */
                        if (state == ST_DECODE1) {
-                               php_error(E_WARNING, "%s(): Stray modified 
base64 character: `%c'", get_active_function_name(TSRMLS_C), *--inp);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Stray modified base64 character: `%c'", *--inp);
                                RETURN_FALSE;
                        }
                        state = ST_NORMAL;
                } else if (!B64CHAR(*inp)) {
-                       php_error(E_WARNING, "%s(): Invalid modified base64 
character: `%c'", get_active_function_name(TSRMLS_C), *inp);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 
modified base64 character: `%c'", *inp);
                        RETURN_FALSE;
                } else {
                        switch (state) {
@@ -2163,15 +2150,12 @@
 
        /* enforce end state */
        if (state != ST_NORMAL) {
-               php_error(E_WARNING, "%s(): Unexpected end of string", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected end of 
string");
                RETURN_FALSE;
        }
 
        /* allocate output buffer */
-       if ((out = emalloc(outlen + 1)) == NULL) {
-               php_error(E_WARNING, "%s(): Unable to allocate result string", 
get_active_function_name(TSRMLS_C));
-               RETURN_FALSE;
-       }
+       out = emalloc(outlen + 1);
 
        /* decode input string */
        outp = out;
@@ -2223,7 +2207,7 @@
 #if PHP_DEBUG
        /* warn if we computed outlen incorrectly */
        if (outp - out != outlen) {
-               php_error(E_WARNING, "%s(): outp - out [%d] != outlen [%d]", 
get_active_function_name(TSRMLS_C), outp - out, outlen);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "outp - out [%d] != 
outlen [%d]", outp - out, outlen);
        }
 #endif
 
@@ -2289,10 +2273,7 @@
        }
 
        /* allocate output buffer */
-       if ((out = emalloc(outlen + 1)) == NULL) {
-               php_error(E_WARNING, "%s(): Unable to allocate result string", 
get_active_function_name(TSRMLS_C));
-               RETURN_FALSE;
-       }
+       out = emalloc(outlen + 1);
 
        /* encode input string */
        outp = out;
@@ -2345,7 +2326,7 @@
 #if PHP_DEBUG
        /* warn if we computed outlen incorrectly */
        if (outp - out != outlen) {
-               php_error(E_WARNING, "%s(): outp - out [%d] != outlen [%d]", 
get_active_function_name(TSRMLS_C), outp - out, outlen);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "outp - out [%d] != 
outlen [%d]", outp - out, outlen);
        }
 #endif
 
@@ -2429,7 +2410,7 @@
        convert_to_long_ex(rev);
        convert_to_long_ex(pgm);
        if (Z_LVAL_PP(pgm) > SORTSIZE) {
-               php_error(E_WARNING, "%s(): Unrecognized sort criteria", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized sort 
criteria");
                RETURN_FALSE;
        }
        if (myargc >= 4) {
@@ -2524,7 +2505,7 @@
  
        msgindex = Z_LVAL_PP(msgno);
        if ((msgindex < 1) || ((unsigned) msgindex > 
imap_le_struct->imap_stream->nmsgs)) {
-               php_error(E_WARNING, "%s(): Bad message number", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message 
number");
                RETURN_FALSE;
        }
 
@@ -2567,9 +2548,7 @@
        convert_to_string_ex(mbx);
        convert_to_long_ex(flags);
 
-       if (object_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       object_init(return_value);
 
        if (mail_status(imap_le_struct->imap_stream, Z_STRVAL_PP(mbx), 
Z_LVAL_PP(flags))) {
                add_property_long(return_value, "flags", IMAPG(status_flags));
@@ -2614,13 +2593,11 @@
        convert_to_string_ex(section);
 
        if (!Z_LVAL_PP(msg) || Z_LVAL_PP(msg) < 1 || (unsigned) Z_LVAL_PP(msg) 
> imap_le_struct->imap_stream->nmsgs) {
-               php_error(E_WARNING, "%s(): Bad message number", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message 
number");
                RETURN_FALSE;
        }
 
-       if (object_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       object_init(return_value);
        
        body=mail_body(imap_le_struct->imap_stream, Z_LVAL_PP(msg), 
Z_STRVAL_PP(section));
        if (body == NULL) {
@@ -2816,12 +2793,12 @@
        }
 
        if (Z_TYPE_PP(envelope) != IS_ARRAY) {
-               php_error(E_WARNING, "%s(): Expected Array as envelope 
parameter", get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as 
envelope parameter");
                RETURN_FALSE;
        }
 
        if (Z_TYPE_PP(body) != IS_ARRAY) {
-               php_error(E_WARNING, "%s(): Expected Array as body parameter", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as 
body parameter");
                RETURN_FALSE;
        }
 
@@ -2878,6 +2855,7 @@
                                custom_headers_param = mail_newbody_parameter();
                                convert_to_string_ex(env_data);
                                custom_headers_param->value = (char *) 
fs_get(Z_STRLEN_PP(env_data) + 1);
+                               custom_headers_param->attribute = NULL;
                                memcpy(custom_headers_param->value, 
Z_STRVAL_PP(env_data), Z_STRLEN_PP(env_data) + 1);
                                zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
                                custom_headers_param->next = tmp_param;
@@ -2909,7 +2887,7 @@
                        convert_to_string_ex(pvalue);
                        tmp_param = mail_newbody_parameter();
                        tmp_param->value = cpystr(Z_STRVAL_PP(pvalue));
-                       tmp_param->attribute = "CHARSET";
+                       tmp_param->attribute = cpystr("CHARSET");
                        tmp_param->next = bod->parameter;
                        bod->parameter = tmp_param;
                }
@@ -2919,7 +2897,7 @@
                                while 
(zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == 
SUCCESS) {
                                        disp_param = mail_newbody_parameter();
                                        
zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
-                                       disp_param->attribute = key;
+                                       disp_param->attribute = cpystr(key);
                                        convert_to_string_ex(disp_data);
                                        disp_param->value = (char *) 
fs_get(Z_STRLEN_PP(disp_data) + 1);
                                        memcpy(disp_param->value, 
Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
@@ -2953,7 +2931,7 @@
                                while 
(zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == 
SUCCESS) {
                                        disp_param = mail_newbody_parameter();
                                        
zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
-                                       disp_param->attribute = key;
+                                       disp_param->attribute = cpystr(key);
                                        convert_to_string_ex(disp_data);
                                        disp_param->value = (char *) 
fs_get(Z_STRLEN_PP(disp_data) + 1);
                                        memcpy(disp_param->value, 
Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
@@ -3017,7 +2995,7 @@
                                tmp_param = mail_newbody_parameter();
                                tmp_param->value = (char *) 
fs_get(Z_STRLEN_PP(pvalue) + 1);
                                memcpy(tmp_param->value, Z_STRVAL_PP(pvalue), 
Z_STRLEN_PP(pvalue) + 1);
-                               tmp_param->attribute = "CHARSET";
+                               tmp_param->attribute = cpystr("CHARSET");
                                tmp_param->next = bod->parameter;
                                bod->parameter = tmp_param;
                        }
@@ -3027,7 +3005,7 @@
                                        while 
(zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == 
SUCCESS) {
                                                disp_param = 
mail_newbody_parameter();
                                                
zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
-                                               disp_param->attribute = key;
+                                               disp_param->attribute = 
cpystr(key);
                                                convert_to_string_ex(disp_data);
                                                disp_param->value = (char *) 
fs_get(Z_STRLEN_PP(disp_data) + 1);
                                                memcpy(disp_param->value, 
Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
@@ -3061,7 +3039,7 @@
                                        while 
(zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == 
SUCCESS) {
                                                disp_param = 
mail_newbody_parameter();
                                                
zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
-                                               disp_param->attribute = key;
+                                               disp_param->attribute = 
cpystr(key);
                                                convert_to_string_ex(disp_data);
                                                disp_param->value = (char *) 
fs_get(Z_STRLEN_PP(disp_data) + 1);
                                                memcpy(disp_param->value, 
Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
@@ -3104,6 +3082,12 @@
                goto done;
        }
 
+       if (bod && bod->type == TYPEMULTIPART && (!bod->nested.part || 
!bod->nested.part->next)) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot generate 
multipart e-mail without components.");
+               RETVAL_FALSE;
+               goto done;
+       }
+
        rfc822_encode_body_7bit(env, topbod); 
        rfc822_header (tmp, env, topbod);
 
@@ -3134,8 +3118,7 @@
 
                efree(tempstring);
        } else {
-               mystring = emalloc(strlen(tmp) + 1);
-               strcpy(mystring, tmp);
+               mystring = estrdup(tmp);
        }
 
        bod = topbod;
@@ -3159,8 +3142,9 @@
 
                /* for each part */
                        do {
+                               t=tmp;
                        /* build cookie */
-                               sprintf (t=tmp, "--%s%s", cookie, CRLF);
+                               sprintf (t, "--%s%s", cookie, CRLF);
 
                        /* append mini-header */
                                rfc822_write_body_header(&t, &part->body);
@@ -3170,10 +3154,9 @@
 
                        /* output cookie, mini-header, and contents */
                                
tempstring=emalloc(strlen(mystring)+strlen(tmp)+1);
-                               strcpy(tempstring, mystring);
+                               sprintf(tempstring, "%s%s", mystring, tmp);
                                efree(mystring);
                                mystring=tempstring;
-                               strcat(mystring, tmp);
 
                                bod=&part->body;
 
@@ -3311,12 +3294,12 @@
                strcat(bufferHeader, headers);
        }
 
-       if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, bufferHeader, 
subject, bufferTo, message, bufferCc, bufferBcc, rpath) != SUCCESS) {
+       if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, bufferHeader, 
subject, bufferTo, message, bufferCc, bufferBcc, rpath TSRMLS_CC) != SUCCESS) {
                if (tsm_errmsg) {
-                       php_error(E_WARNING, "%s(): %s", 
get_active_function_name(TSRMLS_C), tsm_errmsg);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", 
tsm_errmsg);
                        efree(tsm_errmsg);
                } else {
-                       php_error(E_WARNING, "%s(): %s", 
get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err));
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", 
GetSMErrorText(tsm_err));
                }
                PHP_IMAP_CLEAN;
                return 0;
@@ -3344,7 +3327,7 @@
                        return 1;
                }
        } else {
-               php_error(E_WARNING, "%s(): Could not execute mail delivery 
program", get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute 
mail delivery program");
                return 0;
        }
 #endif
@@ -3352,7 +3335,7 @@
 }
 /* }}} */
 
-/* {{{ proto int imap_mail(string to, string subject, string message [, string 
additional_headers [, string cc [, string bcc [, string rpath]]]])
+/* {{{ proto bool imap_mail(string to, string subject, string message [, 
string additional_headers [, string cc [, string bcc [, string rpath]]]])
    Send an email message */
 PHP_FUNCTION(imap_mail)
 {
@@ -3369,7 +3352,7 @@
        if (Z_STRVAL_PP(argv[0])) {
                to = Z_STRVAL_PP(argv[0]);
        } else {
-               php_error(E_WARNING, "%s(): No to field in mail command", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "No to field in 
mail command");
                RETURN_FALSE;
        }
 
@@ -3378,7 +3361,7 @@
        if (Z_STRVAL_PP(argv[1])) {
                subject = Z_STRVAL_PP(argv[1]);
        } else {
-               php_error(E_WARNING, "%s(): No subject field in mail command", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "No subject field 
in mail command");
                RETURN_FALSE;
        }
 
@@ -3388,7 +3371,7 @@
                message = Z_STRVAL_PP(argv[2]);
        } else {
                /* this is not really an error, so it is allowed. */
-               php_error(E_WARNING, "%s(): No message string in mail command", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "No message string 
in mail command");
                message = NULL;
        }
 
@@ -4010,7 +3993,7 @@
        long numNodes = 0;
        char buf[25];
 
-       if(array_init(*tree) != SUCCESS) return FAILURE;
+       array_init(*tree);
        
        build_thread_tree_helper(top, *tree, &numNodes, buf);
 
@@ -4020,7 +4003,7 @@
 
 /* {{{ proto array imap_thread(resource stream_id [, int options])
    Return threaded by REFERENCES tree */
-PHP_FUNCTION (imap_thread)
+PHP_FUNCTION(imap_thread)
 {
        zval **streamind, **search_flags;
        pils *imap_le_struct;
@@ -4045,7 +4028,7 @@
        top = mail_thread(imap_le_struct->imap_stream, "REFERENCES", NIL, 
mail_criteria(criteria), flags);
 
        if(top == NIL) {
-               php_error(E_WARNING, "%s(): Function returned an empty tree", 
get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function returned 
an empty tree");
                RETURN_FALSE;
        }
 
@@ -4060,7 +4043,7 @@
 
 /* {{{ proto mixed imap_timeout(int timeout_type [, int timeout])
    Set or fetch imap timeout */
-PHP_FUNCTION (imap_timeout)
+PHP_FUNCTION(imap_timeout)
 {
        long ttype, timeout=-1;
        int timeout_type;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to