From de6b3a7c280544bc56b68efe6b96b54d7e2ba651 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 28 Oct 2015 01:08:45 +0100 Subject: [PATCH] Fix Markdown %meta.*% replacement Don't even try to use arrays here... --- lib/Pico.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Pico.php b/lib/Pico.php index 0a83929..85e3f0a 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -754,10 +754,13 @@ class Pico $content = str_replace('%theme_url%', $themeUrl, $content); // replace %meta.*% - $metaKeys = array_map(function ($metaKey) { - return '%meta.' . $metaKey . '%'; - }, array_keys($this->meta)); - $metaValues = array_values($this->meta); + $metaKeys = $metaValues = array(); + foreach ($this->meta as $metaKey => $metaValue) { + if (is_scalar($metaValue) || ($metaValue === null)) { + $metaKeys[] = '%meta.' . $metaKey . '%'; + $metaValues[] = strval($metaValue); + } + } $content = str_replace($metaKeys, $metaValues, $content); return $content;