[Pkg-owncloud-commits] [php-sabre-vobject] 40/128: Casting parameters with null value no longer fails.
David Prévot
taffit at moszumanska.debian.org
Tue May 20 23:11:01 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 0093f5f16a17c744f0b6d43e9dbb524725e864c9
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Wed Jan 22 01:54:14 2014 -0500
Casting parameters with null value no longer fails.
Closes #70.
---
ChangeLog.md | 1 +
lib/Sabre/VObject/Parameter.php | 2 +-
tests/Sabre/VObject/ParameterTest.php | 9 +++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/ChangeLog.md b/ChangeLog.md
index a762588..271fa78 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -16,6 +16,7 @@ ChangeLog
* Fixed: Issue #26. Return a more descriptive error when coming across broken
BYDAY rules.
* Fixed: Issue #28. Incorrect timezone detection for some timezones.
+* Fixed: Issue #70. Casting a parameter with a null value to string would fail.
3.1.3 (2013-10-02)
diff --git a/lib/Sabre/VObject/Parameter.php b/lib/Sabre/VObject/Parameter.php
index adf5b69..3f482e0 100644
--- a/lib/Sabre/VObject/Parameter.php
+++ b/lib/Sabre/VObject/Parameter.php
@@ -322,7 +322,7 @@ class Parameter extends Node {
*/
public function __toString() {
- return $this->getValue();
+ return (string)$this->getValue();
}
diff --git a/tests/Sabre/VObject/ParameterTest.php b/tests/Sabre/VObject/ParameterTest.php
index 1dbab87..1be5e6c 100644
--- a/tests/Sabre/VObject/ParameterTest.php
+++ b/tests/Sabre/VObject/ParameterTest.php
@@ -54,6 +54,15 @@ class ParameterTest extends \PHPUnit_Framework_TestCase {
}
+ function testCastNullToString() {
+
+ $cal = new Component\VCalendar();
+ $param = new Parameter($cal, 'name', null);
+ $this->assertEquals('',$param->__toString());
+ $this->assertEquals('',(string)$param);
+
+ }
+
function testSerialize() {
$cal = new Component\VCalendar();
--
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