[Pkg-owncloud-commits] [php-sabre-vobject] 01/06: Converting vcards with a LANG property from 3.0 to 4.0 errors.

David Prévot taffit at moszumanska.debian.org
Sun Jun 14 20:41:56 UTC 2015


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 f69eac58c259b749d99c51345aa62e71eb5e12bc
Author: Evert Pot <me at evertpot.com>
Date:   Thu May 28 17:23:00 2015 -0400

    Converting vcards with a LANG property from 3.0 to 4.0 errors.
    
    Fixes #229
---
 ChangeLog.md                                     |  7 +++++++
 lib/Property/VCard/LanguageTag.php               |  2 +-
 lib/Version.php                                  |  2 +-
 tests/VObject/Property/VCard/LanguageTagTest.php | 21 +++++++++++++++++++++
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index b9143a0..fc8daa6 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,6 +1,13 @@
 ChangeLog
 =========
 
+3.4.5 (2015-??-??)
+------------------
+
+* #229: Converting vcards from 3.0 to 4.0 that contained a `LANG` property
+  would throw an error.
+
+
 3.4.4 (2015-05-27)
 ------------------
 
diff --git a/lib/Property/VCard/LanguageTag.php b/lib/Property/VCard/LanguageTag.php
index fc6b4a5..a475fcc 100644
--- a/lib/Property/VCard/LanguageTag.php
+++ b/lib/Property/VCard/LanguageTag.php
@@ -38,7 +38,7 @@ class LanguageTag extends Property {
      */
     public function getRawMimeDirValue() {
 
-        return $this->value;
+        return $this->getValue();
 
     }
 
diff --git a/lib/Version.php b/lib/Version.php
index 0e4b47d..20783bd 100644
--- a/lib/Version.php
+++ b/lib/Version.php
@@ -14,6 +14,6 @@ class Version {
     /**
      * Full version number
      */
-    const VERSION = '3.4.4';
+    const VERSION = '3.4.5';
 
 }
diff --git a/tests/VObject/Property/VCard/LanguageTagTest.php b/tests/VObject/Property/VCard/LanguageTagTest.php
index 9117810..c38b6f2 100644
--- a/tests/VObject/Property/VCard/LanguageTagTest.php
+++ b/tests/VObject/Property/VCard/LanguageTagTest.php
@@ -24,4 +24,25 @@ class LanguageTagTest extends \PHPUnit_Framework_TestCase {
 
     }
 
+    function testChangeAndSerialize() {
+
+        $input = "BEGIN:VCARD\r\nVERSION:4.0\r\nLANG:nl\r\nEND:VCARD\r\n";
+        $mimeDir = new VObject\Parser\MimeDir($input);
+
+        $result = $mimeDir->parse($input);
+
+        $this->assertInstanceOf('Sabre\VObject\Property\VCard\LanguageTag', $result->LANG);
+        // This replicates what the vcard converter does and triggered a bug in
+        // the past.
+        $result->LANG->setValue(['de']);
+
+        $this->assertEquals('de', $result->LANG->getValue());
+
+        $expected = "BEGIN:VCARD\r\nVERSION:4.0\r\nLANG:de\r\nEND:VCARD\r\n";
+        $this->assertEquals(
+            $expected,
+            $result->serialize()
+        );
+    }
+
 }

-- 
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