SECURITY: Improve regular expression performance

* This patch improves the performance of an
  ext:Gadgets regular expression which helps parse
  out sections of the gadgets definition page.

Bug: T363773
Change-Id: Ic9e1a181b261ae4d25e9ce2f91ad12f92e9855d9
This commit is contained in:
sbassett 2024-05-14 14:37:17 -05:00
parent 5dbf7bce92
commit f2bc65a518

View file

@ -198,7 +198,7 @@ class MediaWikiGadgetsDefinitionRepo extends GadgetRepo {
foreach ( $lines as $line ) {
$m = [];
if ( preg_match( '/^==+ *([^*:\s|]+?)\s*==+\s*$/', $line, $m ) ) {
if ( preg_match( '/^==+ *([^*:\s|]+)\s*(?<!=)==+\s*$/', $line, $m ) ) {
$section = $m[1];
} else {
$gadget = $this->newFromDefinition( $line, $section );