-
Notifications
You must be signed in to change notification settings - Fork 111
Fix HeaderValue throwing an exception on legal characters #28
Conversation
Despite adding an additional test case and adding extra elements to data providers (as well as actually testing a line that was previously never even touched), coverage never seems to go up. I give up; I'll just keep my repo in my composer files. |
Don't worry too much about the coverage; we'll be evaluating the
|
Because the number of relevant lines has decreased then the percentage given to any covered/uncovered line is higher (i.e 2 lines in a pack of 10 has more percentage than 2 lines in a pack of 100) |
Ah, okay. I'll see if I can get a copy of an email that breaks in pretty horrifying ways when reading it and add it in, too. This is the very last issue in a migration from zf2 v2.1.3 to latest + php 5.6, and is essentially a hard blocker :/ |
From http://tools.ietf.org/html/rfc5322#section-2.2
For the purpose of general validation / filtering we opt for choose the "unstructured header" syntax because is the most unrestricted. From http://tools.ietf.org/html/rfc5322#section-3.1
ABNF resume with errata (1905, 1908) applied
|
Header bodies conclusion:
So the following character range may appear without any restriction:
and the characters |
@ameliaikeda This PR is invalid. You didn't fixed your original issue with Please add tests for that scenario. |
if (($ord < 32 || $ord > 126) | ||
&& $ord !== 13 | ||
) { | ||
if ($ord === 10 || $ord > 126) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be > 127
Hello, Not sure about how to tell it or to report i, but i've got a problem relative to this using a character like "é" in the name. It worked well in ZF1 but doesn't in ZF2. Thanks for the coming fix. |
Just got back to this; I'll have updates either later today or tomorrow night. Thanks for the feedback! |
Any chance for to see this finished? |
I know this is about a month old, but is there anyway to get this resolved? I'm running into the same issue in my application ._. |
I'm running into the same issue in my application. Getting the exception when using the character "è" on ReplyTo header ... |
Can lines 37 and 78 on src/Header/HeaderValue.php be merged to resolve this issue? |
I'm also running into this issue :-(. |
Fix HeaderValue throwing an exception on legal characters
- Changes the ASCII out-of-range checks to use `> 127` instead of `> 126`, as 127 is the last ASCII character. - Removed the `testCannotBeConstructed()` test case, as irrelevant. - Added a data provider to test that wrapping header lines using `\r\n\t` is valid. It failed, and, as such, I updated the `isValid()` code to check for both ASCII 32 (SP) and 9 (TAB) when checking for line wrapping.
Hello ! I still have the problem :/. |
@jomofcw |
@froschdesign Hello !
zend-mail seems to be in version 2.9.0, right ? |
2.9.0 is the latest version and also on your system. Btw. here can you find all releases: https://github.com/zendframework/zend-mail/releases |
Thanks @froschdesign . |
In RFC 2822, section 2.2, there are different conditions used for header names vs header values.
Header names are restricted to only printable ascii characters (with folding allowed), while header values are allowed any us-ascii character (and
"\r\n "
) except a bare LF or CR.This is a major problem, because Apache and Outlook/Office365 use tab characters to fold their subject lines. These characters are perfectly valid according to the RFC, yet throw an exception when read.
Relevant spec is below (Section 3.2.1):
Header names are
NO-WS-CTL - specials
, while header values are text with folding allowed.