FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19511&edit=1

ID: 19511
Updated by: till@php.net
Reported By: bkfake-php at yahoo dot com
Summary: vcard fetch method incorrectly requires FN component
for vcard 2.1
-Status: Open
+Status: Duplicate
Type: Bug
Package: File_IMC
Operating System: Windows
Package Version: 0.4.3
PHP Version: 5.3.0
Roadmap Versions:
New Comment:

-Status: Open
+Status: Duplicate
Closing this in favour of the other bug report.


Previous Comments:
------------------------------------------------------------------------

[2012-08-05 16:13:27] bkdotcom

I have created a more extensive overhaul of fetch() as a part of my
patch for bug 19526:
http://pear.php.net/bugs/19526

------------------------------------------------------------------------

[2012-07-17 23:51:42] bkdotcom

Description:
------------
vcard 2.1 requires N & VERSION (FN is NOT required)
vcard 3.0 requires N, FN & VERSION

vcard 2.1 spec: http://www.imc.org/pdi/vcard-21.doc

Build/Vcard.php
public function fetch() has two blocks that need updated:

// FN component is required
if (! is_array($this->value['FN'])) {
throw new File_IMC_Exception(
'FN component not set (required).',
FILE_IMC::ERROR_PARAM_NOT_SET);
}

&&

// formatted name (required)
// available in both 2.1 and 3.0
$lines[] = $this->getFormattedName();

Should Be:
// FN component is required in version 3.0
if ( $this->value['VERSION'][0][0][0] == '3.0' && (
!isset($this->value['FN']) || !is_array($this->value['FN']) ) ) {
throw new File_IMC_Exception(
'FN component not set (required).',
FILE_IMC::ERROR_PARAM_NOT_SET);
}

&&

// formatted name (required in 3.0)
// available in both 2.1 and 3.0
if ( isset($this->value['FN']) && is_array($this->value['FN']) )
$lines[] = $this->getFormattedName();



Expected result:
----------------
when building a version 2.1 vcard, without FN... should NOT throw an
exception

Actual result:
--------------
throws an exception

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 10, '12 at 3:36p
activeAug 10, '12 at 3:36p
posts1
users1
websitepear.php.net

1 user in discussion

Till: 1 post

People

Translate

site design / logo © 2022 Grokbase