From 310201eb5b603c08e7debfdb20c612c2fd847394 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 11 Feb 2015 15:51:31 +0100 Subject: [PATCH] doc/lib: Throw LogicException if text is added without having a heading --- modules/doc/library/Doc/DocParser.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/doc/library/Doc/DocParser.php b/modules/doc/library/Doc/DocParser.php index 08ad5cf56..9077d3ef9 100644 --- a/modules/doc/library/Doc/DocParser.php +++ b/modules/doc/library/Doc/DocParser.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Doc; +use LogicException; use SplStack; use Icinga\Data\Tree\SimpleTree; use Icinga\Exception\NotReadableError; @@ -169,6 +170,9 @@ class DocParser } $stack->push($section); } else { + if ($stack->isEmpty()) { + throw new LogicException('Heading required'); + } $stack->top()->appendContent($line); } // Save last line for setext-style headers