aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-03-14 21:18:17 -0700
committerzotlabs <mike@macgirvin.com>2019-03-14 21:18:17 -0700
commit91b03e52f11375c3be5701a4ba6fb2d07d5b72c0 (patch)
tree05451e9472d11bf597cd3b61cdbe52d0b3f0e9c6
parent05bcbfa28cafae0febcfb63bd39fdcb249f7def0 (diff)
downloadvolse-hubzilla-91b03e52f11375c3be5701a4ba6fb2d07d5b72c0.tar.gz
volse-hubzilla-91b03e52f11375c3be5701a4ba6fb2d07d5b72c0.tar.bz2
volse-hubzilla-91b03e52f11375c3be5701a4ba6fb2d07d5b72c0.zip
email_header_encode() producing lines of illegal length because header field length was not considered in length calculation.
-rw-r--r--include/network.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/network.php b/include/network.php
index 12f2ad4e9..3e8134a32 100644
--- a/include/network.php
+++ b/include/network.php
@@ -874,13 +874,16 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority =
}
-function email_header_encode($in_str, $charset = 'UTF-8') {
+function email_header_encode($in_str, $charset = 'UTF-8', $header = 'Subject') {
+
+
$out_str = $in_str;
$need_to_convert = false;
for($x = 0; $x < strlen($in_str); $x ++) {
if((ord($in_str[$x]) == 0) || ((ord($in_str[$x]) > 128))) {
$need_to_convert = true;
+ break;
}
}
@@ -896,7 +899,7 @@ function email_header_encode($in_str, $charset = 'UTF-8') {
// determine length of encoded text within chunks
// and ensure length is even
- $length = 75 - strlen($start) - strlen($end);
+ $length = 75 - strlen($start) - strlen($end) - (strlen($header) + 2);
/*
[EDIT BY danbrown AT php DOT net: The following