Page MenuHomePhabricator

Glossary: Escaping forward slashes for PCRE functions
Closed, DeclinedPublic

Description

Author: david

Description:
From http://www.mediawiki.org/wiki/Extension:Glossary#Escaping_forward_slashes_for_PCRE_functions

On line 82 within the glossaryParseThisNode function, the following code exists:

$texts = preg_split('/\b(' . preg_quote($term) . 's?)\b/iu', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE);

preg_quote() is meant to escape special regular expression characters from glossary terms. However by default it will not escape the forward slash character that has special meaning in PCRE regular expression functions. You will therefore need to change line 82 to:

$texts = preg_split('/\b(' . preg_quote($term, '/') . 's?)\b/iu', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE);

Without this fix, glossary terms containing a forward slash may cause a lot of rendering errors that make your MediaWiki installation unusable.


Version: unspecified
Severity: critical
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=46773

Details

Reference
bz20008

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:46 PM
bzimport set Reference to bz20008.
bzimport added a subscriber: Unknown Object (MLST).
Aklapper claimed this task.
Aklapper subscribed.

http://www.mediawiki.org/wiki/Extension:Glossary says

"This extension has been archived.

This extension is obsolete.
The following other choices are available:

Lingo
Terminology"