From 7cbbec7f81fc66d1d4ccf821a17cde1eff519e2a Mon Sep 17 00:00:00 2001 From: Dominique FOURNIER Date: Fri, 14 Apr 2023 21:37:54 +0200 Subject: [PATCH] phpstan --- src/Mail.php | 17 +++++++++-------- src/Tcpserver.php | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Mail.php b/src/Mail.php index 121f810..3cbd9a9 100644 --- a/src/Mail.php +++ b/src/Mail.php @@ -302,7 +302,7 @@ class Mail PREG_SPLIT_DELIM_CAPTURE ); // Remove the first 2 dashes : the boundary is stored like in the headers - $boundary = ""; + $boundary = $boundaryCR = ""; while (count($boundaryArray) > 0 && substr($boundary, 0, 2) !== "--") { // Skip the lines until the coundary is found. The boundary start by -- $boundary = array_shift($boundaryArray); @@ -379,9 +379,9 @@ class Mail $headersEML = ltrim(substr($content, 0, $pos + strlen($headerBodySeparator))); $headersArray = []; + $prevCR = ""; if ($headersEML !== "" && $headersEML !== "--") { $prev = ""; - $prevCR = ""; $headersSplit = preg_split( "#([\r\n]+)#", $headersEML, @@ -527,6 +527,7 @@ class Mail // multipart/alternative) $sectionList = $this->sectionList(); $sectionIDtoChange = ""; + $boundary = $boundaryCR = ""; foreach ($sectionList as $sectionID) { $section = $this->sectionGet($sectionID); if ( @@ -628,10 +629,10 @@ class Mail "text/html; charset=$charset", $sectionIDtoChange ); - if (isset($boundary)) { + if ($boundary !== "") { $part["_boundary"] = $boundary; } - if (isset($boundaryCR)) { + if ($boundaryCR != "") { $part["_boundaryCR"] = $boundaryCR; } $this->sectionUpdate($sectionIDtoChange, $part); @@ -654,6 +655,7 @@ class Mail // multipart/alternative) $sectionList = $this->sectionList(); $sectionIDtoChange = ""; + $boundary = ""; foreach ($sectionList as $sectionID) { $section = $this->sectionGet($sectionID); if ( @@ -736,12 +738,9 @@ class Mail "text/plain; charset=$charset", $sectionIDtoChange ); - if (isset($boundary)) { + if ($boundary !== "") { $part["_boundary"] = $boundary; } - if (isset($boundaryCR)) { - $part["_boundaryCR"] = $boundaryCR; - } $this->sectionUpdate($sectionIDtoChange, $part); $this->createMailEML(); } @@ -939,6 +938,7 @@ class Mail ); } // Add the new section to the mixed section + $contentID = ""; $sectionID = $this->sectionAddDefault(); $this->sectionAddChild($sectionIDMixed, $sectionID); $finfo = new \finfo(FILEINFO_MIME); @@ -1059,6 +1059,7 @@ class Mail ), $number), 404); } $part = $this->sectionGet($attachmentIDs[$number]); + $res = []; foreach ($part as $key => $val) { if ($key[0] === "_") { if ( diff --git a/src/Tcpserver.php b/src/Tcpserver.php index b60c412..fa60713 100644 --- a/src/Tcpserver.php +++ b/src/Tcpserver.php @@ -228,6 +228,7 @@ class Tcpserver pcntl_signal(SIGTERM, [$this, "sigTERMINT"]); pcntl_signal(SIGINT, [$this, "sigTERMINT"]); cli_set_process_title($this->processName . " main"); + $sockServer = []; foreach ($this->addresses as $key => $address) { $port = $this->ports[$key]; if (filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {