diff --git a/action/rendertoc.php b/action/rendertoc.php index e39ee97..0e19b99 100644 --- a/action/rendertoc.php +++ b/action/rendertoc.php @@ -120,6 +120,11 @@ function handlePostProcess(Doku_Event $event, $param) { return; } + // Skip processing for non-existent pages to prevent PHP 8.3 TypeError + if (!page_exists($INFO['id'])) { + return; + } + // TOC Position check $tocPosition = @$meta['position'] ?: $this->getConf('tocPosition'); if ($ACT == 'preview') { @@ -175,6 +180,11 @@ function handleTocRender(Doku_Event $event, $param) { return; } + // Skip processing for non-existent pages to prevent PHP 8.3 TypeError + if (!page_exists($INFO['id'])) { + return; + } + // retrieve toc config parameters from metadata $topLv = @$meta['toptoclevel'] ?: $this->getConf('toptoclevel'); $maxLv = @$meta['maxtoclevel'] ?: $this->getConf('maxtoclevel'); @@ -204,6 +214,11 @@ function handleContentDisplay(Doku_Event $event, $param) { return; } + // Skip processing for non-existent pages to prevent PHP 8.3 TypeError + if (!page_exists($INFO['id'])) { + return; + } + // TOC Position check $tocPosition = @$meta['position'] ?: $this->getConf('tocPosition'); if (!in_array($tocPosition, [0,1,2,6])) {