From c430850154b4346bc02ec7dd6c931c4649088b5e Mon Sep 17 00:00:00 2001 From: umherirrender Date: Tue, 12 May 2015 20:43:59 +0200 Subject: [PATCH] Check result of preg_match_all in Parser.php preg_match_all can return false on failure, which than results in undefined index access. Check the result and just keep it as nothing found by processing an empty array Change-Id: I1f11894240dc6869506d68d3513715abdc3abb5d --- includes/parser/Parser.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 27de03929d..4ea68fcbcf 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4446,7 +4446,9 @@ class Parser { $tocraw = array(); $refers = array(); - foreach ( $matches[3] as $headline ) { + $headlines = $numMatches !== false ? $matches[3] : array(); + + foreach ( $headlines as $headline ) { $isTemplate = false; $titleText = false; $sectionIndex = false; -- 2.20.1