Skip to content
Snippets Groups Projects

Issue #3264239: A PCRE error (#2) occurred during results highlighting.

2 files
+ 59
1
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -4,6 +4,7 @@ namespace Drupal\search_api\Plugin\search_api\processor;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\Core\Render\Element;
@@ -656,7 +657,8 @@ class Highlight extends ProcessorPluginBase implements PluginFormInterface {
*/
protected function highlightField($text, array $keys, $html = TRUE) {
if ($html) {
$texts = preg_split('#((?:</?[[:alpha:]](?:[^>"\']*|"[^"]*"|\'[^\']\')*>)+)#i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$filtered_text = Xss::filter($text);
$texts = preg_split('#((?:</?[[:alpha:]](?:[^>"\']*|"[^"]*"|\'[^\']\')*>)+)#i', $filtered_text, -1, PREG_SPLIT_DELIM_CAPTURE);
if ($texts === FALSE) {
$args = [
'%error_num' => preg_last_error(),
Loading