diff options
author | Rui Hirokawa <hirokawa@php.net> | 2001-06-03 01:14:45 +0000 |
---|---|---|
committer | Rui Hirokawa <hirokawa@php.net> | 2001-06-03 01:14:45 +0000 |
commit | 73aee8095f3ae294c288449e8c0d7e7f3c8bda75 (patch) | |
tree | bf9210bc7095c30ca77d89f2786754f12aed583b /ext/mbstring | |
parent | c0779b6db9c2fb7094f25ea64f5792b73a77dd89 (diff) | |
download | php-git-73aee8095f3ae294c288449e8c0d7e7f3c8bda75.tar.gz |
a bug fixed about memory reallocation and added extra parameter support to mb_send_mail().
Diffstat (limited to 'ext/mbstring')
-rw-r--r-- | ext/mbstring/mbstring.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 7d6c64df80..2da30ca94c 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -2256,7 +2256,7 @@ PHP_FUNCTION(mb_convert_variables) if (Z_TYPE_PP(hash_entry) == IS_ARRAY || Z_TYPE_PP(hash_entry) == IS_OBJECT) { if (stack_level >= stack_max) { stack_max += PHP_MBSTR_STACK_BLOCK_SIZE; - ptmp = erealloc(stack, stack_max); + ptmp = erealloc(stack, sizeof(pval **)*stack_max); if (ptmp == NULL) { php_error(E_WARNING, "stack err at %s:(%d)", __FILE__, __LINE__); continue; @@ -2347,7 +2347,7 @@ detect_end: if (Z_TYPE_PP(hash_entry) == IS_ARRAY || Z_TYPE_PP(hash_entry) == IS_OBJECT) { if (stack_level >= stack_max) { stack_max += PHP_MBSTR_STACK_BLOCK_SIZE; - ptmp = erealloc(stack, stack_max); + ptmp = erealloc(stack, sizeof(pval **)*stack_max); if (ptmp == NULL) { php_error(E_WARNING, "stack err at %s:(%d)", __FILE__, __LINE__); continue; @@ -2497,13 +2497,13 @@ PHP_FUNCTION(mb_decode_numericentity) #if HAVE_SENDMAIL -/* {{{ proto int mb_send_mail(string to, string subject, string message [, string additional_headers]) +/* {{{ proto int mb_send_mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]]) Sends an email message with MIME scheme */ PHP_FUNCTION(mb_send_mail) { int argc, n; pval **argv[4]; - char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL; + char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *extra_cmd=NULL; char *message_buf=NULL, *subject_buf=NULL, *p; mbfl_string orig_str, conv_str; mbfl_string *pstr; /* pointer to mbfl string for return value */ @@ -2537,7 +2537,7 @@ PHP_FUNCTION(mb_send_mail) } argc = ZEND_NUM_ARGS(); - if (argc < 3 || argc > 4 || zend_get_parameters_array_ex(argc, argv) == FAILURE) { + if (argc < 3 || argc > 5 || zend_get_parameters_array_ex(argc, argv) == FAILURE) { WRONG_PARAM_COUNT; } @@ -2621,7 +2621,12 @@ PHP_FUNCTION(mb_send_mail) mbfl_memory_device_output('\0', &device); headers = device.buffer; - if (!err && php_mail(to, subject, message, headers, NULL)){ + if (argc == 5) { /* extra options that get passed to the mailer */ + convert_to_string_ex(argv[4]); + extra_cmd = (*argv[4])->value.str.val; + } + + if (!err && php_mail(to, subject, message, headers, extra_cmd)){ RETVAL_TRUE; } else { RETVAL_FALSE; |