[Pkg-owncloud-commits] [php-sabre-vobject] 15/29: VCalendar: Fix timezones stripping.
David Prévot
taffit at moszumanska.debian.org
Sat Dec 12 19:26:59 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 0764d1502283c9d60924b429529786cc03a9649a
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date: Wed Dec 9 16:18:58 2015 +0100
VCalendar: Fix timezones stripping.
The issue is that the `stripTimezones` closure is recursive but the
“self” is not defined. This way it works.
Minimal Working Example:
$a = function ($i) use (&$a) {
var_dump($i);
if ($i < 10) {
$a($i + 1);
}
};
Here we can re-use “self” (`$a`) inside the closure because it is closed
into the same lexical scope thanks to `use (&$a)`.
---
lib/Component/VCalendar.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Component/VCalendar.php b/lib/Component/VCalendar.php
index 513ab73..d6585e1 100644
--- a/lib/Component/VCalendar.php
+++ b/lib/Component/VCalendar.php
@@ -299,7 +299,7 @@ class VCalendar extends VObject\Document {
$timeZone = new DateTimeZone('UTC');
}
- $stripTimezones = function(Component $component) use ($timeZone) {
+ $stripTimezones = function(Component $component) use ($timeZone, &$stripTimezones) {
foreach ($component->children() as $componentChild) {
if ($componentChild instanceof Property\ICalendar\DateTime && $componentChild->hasTime()) {
--
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