From: umherirrender Date: Tue, 12 May 2015 18:43:59 +0000 (+0200) Subject: Check result of preg_match_all in Parser.php X-Git-Tag: 1.31.0-rc.0~11205^2 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=c430850154b4346bc02ec7dd6c931c4649088b5e;p=lhc%2Fweb%2Fwiklou.git 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 --- 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;