From 8cce6075bde9abfba30d3b237e23e43ffbaeecbc Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 5 Oct 2011 06:27:24 +0000 Subject: [PATCH] fixed iCal parser to unescape escaped separators AFTER spliting by them, causing eg. semicolons in vcard N property (name) to fail --- phpgwapi/inc/horde/Horde/iCalendar.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/phpgwapi/inc/horde/Horde/iCalendar.php b/phpgwapi/inc/horde/Horde/iCalendar.php index 50577221af..120f251a20 100644 --- a/phpgwapi/inc/horde/Horde/iCalendar.php +++ b/phpgwapi/inc/horde/Horde/iCalendar.php @@ -822,17 +822,15 @@ class Horde_iCalendar { case 'ORG': $value = trim($value); // As of rfc 2426 2.4.2 semicolon, comma, and colon must - // be escaped (comma is unescaped after splitting below). - $value = str_replace(array('\\n', '\\N', '\\;', '\\:'), - array("\n", "\n", ';', ':'), + // be escaped (semicolon is unescaped after splitting below). + $value = str_replace(array('\\n', '\\N', '\\,', '\\:'), + array("\n", "\n", ',', ':'), $value); // Split by unescaped semicolons: $values = preg_split('/(?setAttribute($tag, trim($value), $params, true, $values); break; @@ -841,15 +839,13 @@ class Horde_iCalendar { case 'CATEGORIES': $value = trim($value); // As of rfc 2426 2.4.2 semicolon, comma, and colon must - // be escaped (semicolon is unescaped after splitting below). - $value = str_replace(array('\\n', '\\N', '\\,', '\\:'), - array("\n", "\n", ',', ':'), + // be escaped (comma is unescaped after splitting below). + $value = str_replace(array('\\n', '\\N', '\\;', '\\:'), + array("\n", "\n", ';', ':'), $value); // Split by unescaped commas: $values = preg_split('/(?setAttribute($tag, trim($value), $params, true, $values); @@ -861,16 +857,14 @@ class Horde_iCalendar { $value = trim($value); // vCalendar 1.0 and vCard 2.1 only escape semicolons // and use unescaped semicolons to create lists. - $value = str_replace(array('\\n', '\\N', '\\;', '\\:'), - array("\n", "\n", ';', ':'), + $value = str_replace(array('\\n', '\\N', '\\,', '\\:'), + array("\n", "\n", ',', ':'), $value); // Split by unescaped semicolons: $values = preg_split('/(?setAttribute($tag, trim($value), $params, true, $values); } else { $value = trim($value);