From 484f71fc6c91c325128cfc855990757caad787a8 Mon Sep 17 00:00:00 2001 From: Benjamin Spiegel Date: Mon, 22 May 2023 00:34:20 -0500 Subject: [PATCH 1/2] Replace deprecated ${var} in strings with {$var} Using `${var}` to embed variables in strings causes warnings starting in PHP 8.2. This commit replaces two instances with `{$var}`, following recommendations in the deprecation notice and related RFC. --- modules/parser-parsedown.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/parser-parsedown.php b/modules/parser-parsedown.php index d1e14bd..6273dfe 100644 --- a/modules/parser-parsedown.php +++ b/modules/parser-parsedown.php @@ -1101,9 +1101,9 @@ class PeppermintParsedown extends ParsedownExtra // The page name is made safe when Pepperminty Wiki does initial consistency checks (if it's unsafe it results in a 301 redirect) $page_name = parsedown_pagename_resolve($matches_url[1]); - $internal_link_text = "[[${page_name}]]"; + $internal_link_text = "[[{$page_name}]]"; if(!empty($matches[1])) // If the display text isn't empty, then respect it - $internal_link_text = "[[${page_name}¦{$matches[1]}]]"; + $internal_link_text = "[[{$page_name}¦{$matches[1]}]]"; $result = $this->inlineInternalLink([ "text" => $internal_link_text From 3abad2e61e84ea69fd5ef6ef63ccd2c6082ff6ad Mon Sep 17 00:00:00 2001 From: Benjamin Spiegel Date: Mon, 22 May 2023 00:55:13 -0500 Subject: [PATCH 2/2] Replace deprecated reset(object) Calling `reset()` on an object causes warnings starting in PHP 8.2. This commit replaces one instance with ArrayIterator object and getIterator() method following a recommendation in the deprecation notice RFC. --- modules/lib-search-engine.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/lib-search-engine.php b/modules/lib-search-engine.php index 00296f7..6b46d76 100644 --- a/modules/lib-search-engine.php +++ b/modules/lib-search-engine.php @@ -831,8 +831,9 @@ class search continue; // Skip terms we shouldn't search the page body for // Loop over the pageindex and search the titles / tags - reset($pageindex); // Reset array/object pointer - foreach($pageindex as $pagename => $pagedata) { + $obj = new ArrayObject($pageindex); + $it = $obj->getIterator(); + foreach($it as $pagename => $pagedata) { // Setup a variable to hold the current page's id $pageid = null; // Cache the page id