From 4321ed46b115e5430033e57f8af42851db838286 Mon Sep 17 00:00:00 2001 From: ma8bi4ne Date: Tue, 23 Jan 2018 18:36:30 +0100 Subject: [PATCH] Fixed memory size error when parsing vcards I recently ran into memory size errors when parsign vcards. I found a fix by adding an "array_filter" in line 576. Also see here: http://php.net/manual/de/function.explode.php#99830 --- vCard.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vCard.php b/vCard.php index b2f0476..08ebbd2 100644 --- a/vCard.php +++ b/vCard.php @@ -573,7 +573,7 @@ private static function ParseParameters($Key, array $RawParams = null) $Parameters = array(); foreach ($RawParams as $Item) { - $Parameters[] = explode('=', strtolower($Item)); + $Parameters[] = array_filter(explode('=', strtolower($Item))); } $Type = array(); @@ -603,7 +603,7 @@ private static function ParseParameters($Key, array $RawParams = null) } elseif (count($Parameter) > 2) { - $TempTypeParams = self::ParseParameters($Key, explode(',', $RawParams[$Index])); + $TempTypeParams = self::ParseParameters($Key, explode(',', $RawParams[$Index])); if ($TempTypeParams['type']) { $Type = array_merge($Type, $TempTypeParams['type']); @@ -686,4 +686,4 @@ public function key() return key($this -> Data); } } -?> \ No newline at end of file +?>