Home » File Formats » Contact_Vcard_Parse » Bug #4445
vCard Parser fails when N field doesn't contain all fields.
Details
| Submitted | 2005-05-26 19:02 UTC |
|---|---|
| From | mike_walsh at mentor dot com |
| Assigned | pmjones |
| Status | Closed |
| Package | Contact_Vcard_Parse |
| PHP Version | 4.3.10 |
| OS | WindowsXP, Solaris 2.8 |
| Roadmaps | (Not assigned) |
Comments
[2005-05-26 19:02 UTC] mike_walsh at mentor dot com
Description:
------------
I have been playing with the Parser class and have a question. The sample vCards I have been testing with do not contain full "N" fields, that is, they have first and last names but not prefixes, suffixes, etc.
The _parseN() method appears to have hardcoded an expectation that all five components of the N field will exist.
Because my vCards don't, are they flawed? They were saved directly from Microsoft Outlook.
Reproduce code:
---------------
BEGIN:VCARD
VERSION:2.1
N:vCard;Sample
FN:Sample vCard
ORG:vCard Solutions, Inc.
TEL;WORK;VOICE:+1 (919) 555-1212
TEL;CELL;VOICE:+1 (919) 555-1212
TEL;WORK;FAX:+1 (919) 555-1212
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;;1234 Any St.=0D=0ASuite 456789;Timbuktu;CA;12345
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:1234 Any St.=0D=0ASuite 456789=0D=0ATimbuktu, CA 12345
EMAIL;PREF;INTERNET:sample@vcard.com
REV:20050526T190031Z
END:VCARD
Expected result:
----------------
I expect the above vCard which was saved directly from Microsoft Outlook to parse correctly without errors. Because the "N" field only has two of the five expected fields, the Parser class reports missing array elements.