Check result of preg_match_all in Parser.php
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 12 May 2015 18:43:59 +0000 (20:43 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 29 May 2015 05:16:08 +0000 (05:16 +0000)
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

index 27de039..4ea68fc 100644 (file)
@@ -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;