summaryrefslogtreecommitdiff
path: root/ext/imap/php_imap.c
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2000-08-01 09:11:46 +0000
committerfoobar <sniper@php.net>2000-08-01 09:11:46 +0000
commitab13d02d5320edc7906c212dd50f16ea2833f5fc (patch)
treefb360c5a5bb174a9af4fd7e537703ca08a9de350 /ext/imap/php_imap.c
parentb59e98b87cdd25d3987a77b75fcbfa46c75ed37d (diff)
downloadphp-git-ab13d02d5320edc7906c212dd50f16ea2833f5fc.tar.gz
@- Fixed bug in imap_fetchheader() where using FT_PREFETCHTEXT didn't return
@ the body. Bug #4447. (Jani)
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r--ext/imap/php_imap.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index ee9f29678d..122178a043 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -2621,8 +2621,10 @@ PHP_FUNCTION(imap_fetchheader)
zval **streamind, **msgno, **flags;
int ind, ind_type, msgindex;
pils *imap_le_struct;
+ char *body, *header, *tempstring;
+ unsigned long blen, hlen;
int myargc = ZEND_NUM_ARGS();
-
+
if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &msgno, &flags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -2652,8 +2654,18 @@ PHP_FUNCTION(imap_fetchheader)
php_error(E_WARNING, "Bad message number");
RETURN_FALSE;
}
-
- RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL, myargc==3 ? Z_LVAL_PP(flags) : NIL), 1);
+
+ if ((myargc == 3) && (Z_LVAL_PP(flags) & FT_PREFETCHTEXT)) {
+ header = mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, &hlen, Z_LVAL_PP(flags));
+ body = mail_fetchtext_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), &blen, Z_LVAL_PP(flags));
+ tempstring = emalloc(hlen+blen+1);
+ strcpy(tempstring,header);
+ strcat(tempstring,body);
+ RETVAL_STRINGL(tempstring,(hlen+blen+1),1);
+ efree(tempstring);
+ } else {
+ RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL, NIL), 1);
+ }
}
/* }}} */