[Pkg-owncloud-commits] [php-sabre-vobject] 32/43: handle empty parameters
David Prévot
taffit at moszumanska.debian.org
Fri Oct 10 14:16:17 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit 8b45fffeefc1e0529ca0fa4cd7a21f4eec9a70e7
Author: Dominik Tobschall <dominik at fruux.com>
Date: Thu Oct 2 16:34:13 2014 +0200
handle empty parameters
---
lib/Parameter.php | 8 +++++++-
tests/VObject/IssueEmptyParameterTest.php | 32 +++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/lib/Parameter.php b/lib/Parameter.php
index e6975df..3081bae 100644
--- a/lib/Parameter.php
+++ b/lib/Parameter.php
@@ -58,7 +58,13 @@ class Parameter extends Node {
$this->noName = true;
$this->name = static::guessParameterNameByValue($value);
}
- $this->setValue($value);
+ if ($this->name == '') {
+ $this->noName = false;
+ $this->name = strtoupper($value);
+ } else {
+ $this->setValue($value);
+ }
+
}
/**
diff --git a/tests/VObject/IssueEmptyParameterTest.php b/tests/VObject/IssueEmptyParameterTest.php
new file mode 100644
index 0000000..3f28597
--- /dev/null
+++ b/tests/VObject/IssueEmptyParameterTest.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Sabre\VObject;
+
+class IssueEmptyParameterTest extends \PHPUnit_Framework_TestCase {
+
+ function testRead() {
+
+ $input = <<<VCF
+BEGIN:VCARD
+VERSION:2.1
+N:Doe;Jon;;;
+FN:Jon Doe
+EMAIL;X-INTERN:foo at example.org
+UID:foo
+END:VCARD
+VCF;
+
+ $vcard = Reader::read($input);
+
+ $this->assertInstanceOf('Sabre\\VObject\\Component\\VCard', $vcard);
+ $vcard = $vcard->convert(\Sabre\VObject\Document::VCARD30);
+ $vcard = $vcard->serialize();
+
+ $converted = Reader::read($vcard);
+ $converted->validate();
+
+ $this->assertTrue(isset($converted->EMAIL['X-INTERN']));
+
+ }
+
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list