aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/http/MetadataRetriever.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-12-16 14:04:32 +0100
committerArthurHoaro <arthur@hoa.ro>2020-12-16 14:04:32 +0100
commit6a3a78d023aa320138bb88505b58347db268264a (patch)
tree127cbde2d900fb1cf9d2f5999941dfe3d79affbd /application/http/MetadataRetriever.php
parente4b8330e459b598328bf250208386c06ec257b08 (diff)
downloadShaarli-6a3a78d023aa320138bb88505b58347db268264a.tar.gz
Shaarli-6a3a78d023aa320138bb88505b58347db268264a.tar.zst
Shaarli-6a3a78d023aa320138bb88505b58347db268264a.zip
Fix: synchronous metadata retrieval is failing in strict mode
Metadata can now only be string or null. Fixes #1653
Diffstat (limited to 'application/http/MetadataRetriever.php')
-rw-r--r--application/http/MetadataRetriever.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/application/http/MetadataRetriever.php b/application/http/MetadataRetriever.php
index 2e1401ec..cfc72583 100644
--- a/application/http/MetadataRetriever.php
+++ b/application/http/MetadataRetriever.php
@@ -60,10 +60,15 @@ class MetadataRetriever
60 $title = mb_convert_encoding($title, 'utf-8', $charset); 60 $title = mb_convert_encoding($title, 'utf-8', $charset);
61 } 61 }
62 62
63 return [ 63 return array_map([$this, 'cleanMetadata'], [
64 'title' => $title, 64 'title' => $title,
65 'description' => $description, 65 'description' => $description,
66 'tags' => $tags, 66 'tags' => $tags,
67 ]; 67 ]);
68 }
69
70 protected function cleanMetadata($data): ?string
71 {
72 return !is_string($data) || empty(trim($data)) ? null : trim($data);
68 } 73 }
69} 74}