Fix iCal parameter parser

This commit is contained in:
Jörg Lehrke 2010-05-21 16:22:10 +00:00
parent d7befada9c
commit 328f92cedf

View File

@ -628,14 +628,14 @@ class Horde_iCalendar {
// Parse the remaining attributes. // Parse the remaining attributes.
if (preg_match_all('/^((?:[^":]+|(?:"[^"]*")+)*):([^\r\n]*)\r?$/m', $vCal, $matches)) { if (preg_match_all('/^((?:[^":]+|(?:"[^"]*")+)*):([^\r\n]*)\r?$/m', $vCal, $matches)) {
foreach ($matches[0] as $attribute) { foreach ($matches[0] as $attribute) {
preg_match('/([^;^:]*)((;(?:[^":]+|(?:"[^"]*")+)*)?):([^\r\n]*)[\r\n]*/', $attribute, $parts); preg_match('/([^:;]*)((;(?:(?:[^":\\\]*(?:\\\.)?)+|(?:"[^"]*")+)*)?):([^\r\n]*)[\r\n]*/', $attribute, $parts);
$tag = trim(String::upper($parts[1])); $tag = trim(String::upper($parts[1]));
$value = $parts[4]; $value = $parts[4];
$params = array(); $params = array();
// Parse parameters. // Parse parameters.
if (!empty($parts[2])) { if (!empty($parts[2])) {
preg_match_all('/;(([^;=]*)(=([^;]*))?)/', $parts[2], $param_parts); preg_match_all('/;(([^;=]*)(=("[^"]*"|(?:[^;\\\]*(?:\\\.)?)*))?)/', $parts[2], $param_parts);
foreach ($param_parts[2] as $key => $paramName) { foreach ($param_parts[2] as $key => $paramName) {
$paramName = String::upper($paramName); $paramName = String::upper($paramName);
$paramValue = $param_parts[4][$key]; $paramValue = $param_parts[4][$key];