This repository was archived by the owner on Jan 30, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -144,4 +144,25 @@ public function testSemicolonSeparator()
144144 $ this ->assertTrue ($ addressList ->has ('asda.fasd@example.net ' ));
145145 $ this ->assertTrue ($ addressList ->has ('root@example.org ' ));
146146 }
147+
148+ /**
149+ * If name-field is quoted with "", then ' inside it should not treated as terminator, but as value.
150+ */
151+ public function testMixedQuotesInName () {
152+ $ header = '"Bob O \'Reilly" <bob@example.com>,blah@example.com ' ;
153+
154+ // In previous versions, this throws:
155+ // 'Bob O'Reilly <bob@example.com>,blah' can not be matched against dot-atom format
156+ // hence the try/catch block, to allow finding the root cause.
157+ try {
158+ $ to = Header \To::fromString ('To: ' . $ header );
159+ } catch (InvalidArgumentException $ e ) {
160+ $ this ->fail ('Header\To::fromString should not throw. Exception message: ' . $ e ->getMessage ());
161+ }
162+
163+ $ addressList = $ to ->getAddressList ();
164+ $ this ->assertTrue ($ addressList ->has ('bob@example.com ' ));
165+ $ this ->assertTrue ($ addressList ->has ('blah@example.com ' ));
166+ $ this ->assertEquals ("Bob O'Reilly " , $ addressList ->get ('bob@example.com ' )->getName ());
167+ }
147168}
You can’t perform that action at this time.
0 commit comments