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

ListParser::parse parses string incorrectly #222

@svaningelgem

Description

@svaningelgem

Code to reproduce the issue

include "vendor\zendframework\zend-mail\src\Header\ListParser.php"
var_dump(\Zend\Mail\Header\ListParser::parse("\"a'b\" <[email protected]>, def <[email protected]>"));

Expected results

array(2) {
[0]=>
string(19) ""a'b" [email protected]"
[1]=>
string(18) " def [email protected]"
}

Actual results

array(1) {
[0]=>
string(38) ""a'b" [email protected], def [email protected]"
}

Solution

Add the following else-if branch under the current one.
Rationale: if you're in a quoted-string, don't look for more quotes as they're part of the comment.

            if ($char === $currentQuoteDelim) {
                $inQuote = false;
                $currentQuoteDelim = null;
                continue;
            }
            // We are in a quote, but encountered another quote-char: don't do anything.
            else if ( $inQuote ) {
              continue;
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions