From 38019f441aeba2a04c2b3ab372408d5a81a82b54 Mon Sep 17 00:00:00 2001 From: sbassett Date: Tue, 14 May 2024 14:37:17 -0500 Subject: [PATCH] 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 (cherry picked from commit f2bc65a518672c20de1a9271530992d80bdf338a) --- includes/MediaWikiGadgetsDefinitionRepo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/MediaWikiGadgetsDefinitionRepo.php b/includes/MediaWikiGadgetsDefinitionRepo.php index 96389e0a..1be5cf24 100644 --- a/includes/MediaWikiGadgetsDefinitionRepo.php +++ b/includes/MediaWikiGadgetsDefinitionRepo.php @@ -173,7 +173,7 @@ class MediaWikiGadgetsDefinitionRepo extends GadgetRepo { foreach ( $lines as $line ) { $m = []; - if ( preg_match( '/^==+ *([^*:\s|]+?)\s*==+\s*$/', $line, $m ) ) { + if ( preg_match( '/^==+ *([^*:\s|]+)\s*(?newFromDefinition( $line, $section );