Recognizing mime boundary according to RFC
This commit is contained in:
parent
6e117940a3
commit
d68c25daad
|
@ -27,7 +27,7 @@ class MimeBoundaryAnalyser
|
||||||
*/
|
*/
|
||||||
public static function isMessageLineBoundary($mimeMessageLine)
|
public static function isMessageLineBoundary($mimeMessageLine)
|
||||||
{
|
{
|
||||||
return strlen($mimeMessageLine) > 0 && $mimeMessageLine[0] === "-";
|
return preg_match('/^--[0-9A-Za-z\s\'\/\+\_\,\-\.\:\=\?]+/', $mimeMessageLine) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -67,6 +67,8 @@ class MimeBoundaryAnalyserTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['-- this line is boundary', self::EXPECTED_IS_BOUNDARY],
|
['-- 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],
|
['-- 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],
|
||||||
[' -- mesage line -- is not boundary', self::EXPECTED_IS_NOT_BOUNDARY],
|
[' -- mesage line -- is not boundary', self::EXPECTED_IS_NOT_BOUNDARY],
|
||||||
|
|
Loading…
Reference in New Issue