[Tickets #7031] Re: Colons within quoted parameter values are not handled correctly
bugs at horde.org
bugs at horde.org
Sun Jul 6 22:05:50 UTC 2008
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/7031
------------------------------------------------------------------------------
Ticket | 7031
Updated By | Jan Schneider <jan at horde.org>
Summary | Colons within quoted parameter values are not handled
| correctly
Queue | Horde Framework Packages
Version | FRAMEWORK_3
Type | Bug
-State | Unconfirmed
+State | Feedback
Priority | 2. Medium
Milestone |
-Patch | 1
+Patch |
Owners |
------------------------------------------------------------------------------
Jan Schneider <jan at horde.org> (2008-07-06 18:05) wrote:
It's far more complicated than that unfortunately, because the same
regex must also parse vCalendar 1.0 properties which are escaped
differently. Those only require semicolons in parameter values to be
escaped by a preceding backslash.
I came up with the following so far:
$name_re = '[-a-zA-Z0-9]+';
$param_text_re = '[^";:,]*';
$quoted_string_re = '"[^"]*"';
$param_value_re = $param_text_re . '|' . $quoted_string_re;
$param_re = $name_re . '=' . $param_value_re;
$old_param_re = '(?:' . $name_re . '=)?(?:[^;]|(?<=\\\\);)*';
And then run the preg_match like so:
preg_match('/(' . $name_re . ')(;(?:' . $param_re . '|' .
$old_param_re . '))*:([^\r\n]*)[\r\n]*/',
$attribute, $parts);
This doesn't work unfortunately either, because the regex for the old
format is too greedy. If using an ungreedy modifier, it becomes too
ungreedy.
More information about the bugs
mailing list