$message = (string) $message;
$offset = 0;
$output = '';
- $tagRegex = '[a-z][a-z0-9_=;-]*+';
+ $tagRegex = '[a-z][a-z0-9,_=;-]*+';
preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
foreach ($matches[0] as $i => $match) {
$pos = $match[1];
return $this->styles[$string];
}
- if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
+ if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) {
return false;
}
$style->setForeground($match[1]);
} elseif ('bg' == $match[0]) {
$style->setBackground($match[1]);
- } else {
- try {
- $style->setOption($match[1]);
- } catch (\InvalidArgumentException $e) {
- return false;
+ } elseif ('options' === $match[0]) {
+ preg_match_all('([^,;]+)', $match[1], $options);
+ $options = array_shift($options);
+ foreach ($options as $option) {
+ try {
+ $style->setOption($option);
+ } catch (\InvalidArgumentException $e) {
+ @trigger_error(sprintf('Unknown style options are deprecated since version 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), E_USER_DEPRECATED);
+
+ return false;
+ }
}
+ } else {
+ return false;
}
}