[Pkg-owncloud-commits] [php-sabre-vobject] 09/19: PHP 5.3 fixes and fixed default document case. #216.

David Prévot taffit at moszumanska.debian.org
Tue May 19 20:10:13 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 e3b5de93136eca8fde9485b14ba7f8b0ad52ef75
Author: Evert Pot <me at evertpot.com>
Date:   Thu Mar 26 15:44:17 2015 -0700

    PHP 5.3 fixes and fixed default document case. #216.
---
 lib/Property.php               | 4 +++-
 tests/VObject/PropertyTest.php | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/Property.php b/lib/Property.php
index d9a8739..58cf795 100644
--- a/lib/Property.php
+++ b/lib/Property.php
@@ -518,6 +518,8 @@ abstract class Property extends Node {
 
                 $encoding = (string)$encoding;
 
+                $allowedEncoding = array();
+
                 switch($this->root->getDocumentType()) {
                     case Document::ICALENDAR20 :
                         $allowedEncoding = array('8BIT', 'BASE64');
@@ -530,7 +532,7 @@ abstract class Property extends Node {
                         break;
 
                 }
-                if (!in_array(strtoupper($encoding), $allowedEncoding)) {
+                if ($allowedEncoding && !in_array(strtoupper($encoding), $allowedEncoding)) {
                     $warnings[] = array(
                         'level' => 1,
                         'message' => 'ENCODING=' . strtoupper($encoding) . ' is not valid for this document type.',
diff --git a/tests/VObject/PropertyTest.php b/tests/VObject/PropertyTest.php
index 291d09b..7e600bc 100644
--- a/tests/VObject/PropertyTest.php
+++ b/tests/VObject/PropertyTest.php
@@ -372,7 +372,7 @@ class PropertyTest extends \PHPUnit_Framework_TestCase {
 
     function testValidateBadEncodingVCard4() {
 
-        $document = new VCard(['VERSION' => '4.0']);
+        $document = new VCard(array('VERSION' => '4.0'));
         $property = $document->add('X-FOO','value');
         $property['ENCODING'] = 'BASE64';
 
@@ -385,7 +385,7 @@ class PropertyTest extends \PHPUnit_Framework_TestCase {
 
     function testValidateBadEncodingVCard3() {
 
-        $document = new VCard(['VERSION' => '3.0']);
+        $document = new VCard(array('VERSION' => '3.0'));
         $property = $document->add('X-FOO','value');
         $property['ENCODING'] = 'BASE64';
 
@@ -398,7 +398,7 @@ class PropertyTest extends \PHPUnit_Framework_TestCase {
 
     function testValidateBadEncodingVCard21() {
 
-        $document = new VCard(['VERSION' => '2.1']);
+        $document = new VCard(array('VERSION' => '2.1'));
         $property = $document->add('X-FOO','value');
         $property['ENCODING'] = 'B';
 

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