PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » File Formats » Contact_Vcard_Parse » Bug #4079

lower case of Type-Definition

Details

Submitted2005-04-06 13:48 UTC
Fromvaleksa at gmail dot com
Assignedpmjones
StatusClosed
PackageContact_Vcard_Parse
PHP Version4.3.10
OSbegin:vcard
Roadmaps(Not assigned)

Comments

[2005-04-06 13:48 UTC] valeksa at gmail dot com

Description:
------------
class version : 1.30
[code]
// include the PEAR VCard class file
include_once('Contact_Vcard_Parse.php');

// instantiate a parser object
$parse = new Contact_Vcard_Parse();

// parse a vCard file and store the data
// in $cardinfo
$cardinfo = $parse->fromFile('VCard.vcf');

// view the card info array
echo "<pre>CARD";
print_r($cardinfo);
echo "</pre>";
[/code]

If in cvf file Type_definition is in lowercase result is:
CARDArray
(
[0] => Array
(
[fn] => Array
(
[0] => Array
(
[param] => Array
(
[ENCODING] => Array
(
[0] => QUOTED-PRINTABLE
)
)
[value] => Array
(
[0] => Array
(
[0] => First Last
)
)
)

)
...continue

Reproduce code:
---------------
Sample VCard.vcf
[quote]
begin:vcard
fn;quoted-printable:First last
org:Comapny;department
adr;quoted-printable:;;adress;city;;postNumer;Country
email;internet:test@test.com
tel;work:+111 11 111111
tel;fax:+222 22 222222
url:http://www.test.com
version:2.1
end:vcard
[/quote]
PATCH:
function _getTypeDef($text)
{
// split the text by semicolons
$split = $this->splitBySemi($text);

// only return first element (the typedef)
return strtoupper($split[0]);
} ^^^^^^^^^^^ ^

Expected result:
----------------
Think that output array indexes MUST be in uppercase.
CARDArray
(
[0] => Array
(
[FN] => Array
(
[0] => Array
(
[param] => Array
(
[ENCODING] => Array
(
[0] => QUOTED-PRINTABLE
)
)
[value] => Array
(
[0] => Array
(
[0] => First Last
)
)
)
)
...continue