testcase for broken Header\AbstractAddressList::fromString#146
testcase for broken Header\AbstractAddressList::fromString#146glensc wants to merge 1 commit intozendframework:masterfrom
Conversation
|
toString invocation path:
|
this does solve GenericHeader::toString + Header\AbstractAddressList::fromString problem reported here: zendframework/zend-mail#146
|
perhaps the fix is in zend-mime project: if it gets accepted! |
|
after zendframework/zend-mime#26 being applied, $headerLine = 'To: "=?iso-8859-1?Q?W=2C_bj=F8rn?=" <user@example.org>';
echo Mail\Header\GenericHeader::fromString($headerLine)->toString();before: now: and // with headerline without comma:
$headerLine = 'To: =?UTF-8?Q?"W=2C=20bj=C3=B8rn"=20<user@example.org>?=';
echo Mail\Header\To::fromString($headerLine)->toString(); |
got totally drowned in zend/mail, zend/mime, and eventum bugs zendframework/zend-mime#26 zendframework/zend-mail#146
|
@weierophinney closed this in zendframework/zend-mime@73e6d05 15 days ago this is not correct. reopen please. |
|
@glensc I think I'm not understanding something. The original string includes an encoded comma ( Why should the comma NOT be encoded when the (I need to understand why your expectation should be the expected behavior, basically.) |
|
@weierophinney it's combination of these two statements from Pull Description:
i tried to explain the problem in test comments as well: https://github.com/zendframework/zend-mail/pull/146/files if my explanation is not understandable (not sure i catched your question), just see the test code and how it behaves. it's a lot of information and i dealed with this problem more than year ago.... so, this seemed the simplest way to solve the problem. it's not forbidden to zealously encode as zendframework/zend-mime@73e6d05 was accepted in zendframework/zend-mime#26 this just updates unit test data. |
| $genericHeader = Mail\Header\GenericHeader::fromString('To: "=?iso-8859-1?Q?W=2C_bj=F8rn?=" <user@example.org>'); | ||
| $this->assertEquals('"W, bjørn" <user@example.org>', $genericHeader->getFieldValue()); | ||
|
|
||
| $headers->addHeader($genericHeader); |
There was a problem hiding this comment.
This test case doesn't make sense given the assertions in your comments and the issue description.
You're making the case that AbstractAddressList::fromString() is splitting on a comma, but that toString() on such headers is not encoding it.
What I'm seeing here is quite different:
- You're testing the behavior of a
GenericHeader, not one that is based onAbstractAddressList. - Your assertion is that the expected behavior of
toString()is NOT to encode the comma.
That's the crux of my confusion: the test is not setting up the conditions you describe, nor testing the expectation you describe.
Can you please clarify?
|
This repository has been moved to laminas/laminas-mail. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
|
|
This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at laminas/laminas-mail#44. |
Problem:
Lazyload does stringify and load in from string
However, toString does not encode comma
AND To header class does split on comma!
see \Zend\Mail\Header\AbstractAddressList::fromString
this PR shows only the problem.