Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fruux/sabre-vobject
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed Oct 2, 2013
2 parents 78677cc + 792ca98 commit 961546d
Show file tree
Hide file tree
Showing 4 changed files with 398 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Added: --forgiving option to vobject utility.
* Fixed: Compound properties such as ADR were not correctly split up in
vCard 2.1 quoted printable-encoded properties.
* Fixed: Issue 64: Encoding of binary properties of converted vCards.
Thanks @DominikTo for the patch.

3.1.2-stable (2013-08-13)
* Fixed: Setting correct property group on VCard conversion
Expand Down
26 changes: 26 additions & 0 deletions lib/Sabre/VObject/Property/Binary.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ class Binary extends Property {
*/
public $delimiter = null;

/**
* Updates the current value.
*
* This may be either a single, or multiple strings in an array.
*
* @param string|array $value
* @return void
*/
public function setValue($value) {

if(is_array($value)) {

if(count($value) === 1) {
$this->value = $value[0];
} else {
throw new \InvalidArgumentException('The argument must either be a string or an array with only one child');
}

} else {

$this->value = $value;

}

}

/**
* Sets a raw value coming from a mimedir (iCalendar/vCard) file.
*
Expand Down
19 changes: 19 additions & 0 deletions tests/Sabre/VObject/Issue64Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Sabre\VObject;

class Issue64Test extends \PHPUnit_Framework_TestCase {

function testRead() {

$vcard = Reader::read(file_get_contents(dirname(__FILE__) . '/issue64.vcf'));
$vcard = $vcard->convert(\Sabre\VObject\Document::VCARD30);
$vcard = $vcard->serialize();

$converted = Reader::read($vcard);

$this->assertInstanceOf('Sabre\\VObject\\Component\\VCard', $converted);

}

}
Loading

0 comments on commit 961546d

Please sign in to comment.