Merge pull request #7 from tuscanicz/develop

Recognizing mime boundary according to RFC
This commit is contained in:
Petr Bechyně 2017-08-23 16:11:19 +02:00 committed by GitHub
commit 7ab8771989
2 changed files with 3 additions and 1 deletions

View File

@ -27,7 +27,7 @@ class MimeBoundaryAnalyser
*/
public static function isMessageLineBoundary($mimeMessageLine)
{
return strlen($mimeMessageLine) > 0 && $mimeMessageLine[0] === "-";
return preg_match('/^--[0-9A-Za-z\s\'\/\+\_\,\-\.\:\=\?]+/', $mimeMessageLine) === 1;
}
/**

View File

@ -67,6 +67,8 @@ class MimeBoundaryAnalyserTest extends PHPUnit_Framework_TestCase
{
return [
['-- this line is boundary', self::EXPECTED_IS_BOUNDARY],
['--this line is boundary', self::EXPECTED_IS_BOUNDARY],
['--@ this line is not boundary', self::EXPECTED_IS_NOT_BOUNDARY],
['-- this line is also a boundary --', self::EXPECTED_IS_BOUNDARY],
['mesage line -- is not boundary', self::EXPECTED_IS_NOT_BOUNDARY],
[' -- mesage line -- is not boundary', self::EXPECTED_IS_NOT_BOUNDARY],