Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge 1ca467c into ece418b
Browse files Browse the repository at this point in the history
  • Loading branch information
silvadiego committed Mar 17, 2019
2 parents ece418b + 1ca467c commit b986cde
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#226](https://github.com/zendframework/zend-mail/pull/226) fixes how `Zend\Mail\Header\ListParser::parse()` parses the string if a different quote delimiter
is found when already in quote.

## 2.10.0 - 2018-06-07

Expand Down
6 changes: 6 additions & 0 deletions src/Header/ListParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public static function parse($value, array $delims = self::CHAR_DELIMS)
continue;
}

// If already in quote and the character does not match the previously
// matched quote delimiter, we're done here.
if ($inQuote) {
continue;
}

// Otherwise, we're starting a quoted string.
$inQuote = true;
$currentQuoteDelim = $char;
Expand Down
26 changes: 26 additions & 0 deletions test/Header/ListParser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* @see https://github.com/zendframework/zend-mail for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-mail/blob/master/LICENSE.md New BSD License
*/

namespace ZendTest\Mail\Header;

use PHPUnit\Framework\TestCase;
use Zend\Mail\Header\ListParser;

/**
* @covers Zend\Mail\Header\ListParser<extended>
*/
class ListParserTest extends TestCase
{
public function testParseIgnoreQuoteDelimiterIfAlreadyInQuote()
{
$parsed = ListParser::parse('"john\'doe" <john@doe.com>,jane <jane@doe.com>');
$this->assertEquals($parsed, [
'"john\'doe" <john@doe.com>',
'jane <jane@doe.com>'
]);
}
}

0 comments on commit b986cde

Please sign in to comment.