File memory_footprint_dkim.diff of Package roundcubemail-plugin-authres_status
--- a/php-dkim-0.2.2/DKIM.php 2025-03-11 15:15:24.315338097 +0100
+++ b/php-dkim-0.2.2/DKIM.php 2025-03-11 15:15:13.651839476 +0100
@@ -154,12 +154,13 @@
$raw = (isset($this->_params['headers'])) ?
str_replace("\r", '', $this->_params['headers'])
: str_replace("\r", '', $this->_raw);
- $lines = explode("\n", $raw);
$rawHeaders = array();
$headerVal = array();
$counter = 0;
$on = false;
- foreach ($lines as $line) {
+ $pos = 0;
+ while ( ($line_end_pos = strpos($raw, "\n", $pos)) !== false ) {
+ $line = substr($raw, $pos, $line_end_pos - $pos);
if ($on === true) {
if (preg_match('/^\w/', $line) !== 0 || trim($line) == '') {
// new header is starting or end of headers
@@ -188,6 +189,7 @@
if (trim($line) == '') {
break;
}
+ $pos = $line_end_pos + 1;
}
return $rawHeaders;