From b10b40e5c9492fb9f1225c4e8eb9f0ff797d9765 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 16 Feb 2023 15:30:29 +0100 Subject: [PATCH] ContentExtractor: Fix invalid argument type This was tripping up selfoss: date_parse(): Passing null to parameter #1 ($datetime) of type string is deprecated [vendor/j0k3r/graby/src/Extractor/ContentExtractor.php:722] [vendor/j0k3r/graby/src/Extractor/ContentExtractor.php:722] date_parse() [vendor/j0k3r/graby/src/Extractor/ContentExtractor.php:541] Graby\Extractor\ContentExtractor->validateDate() [vendor/j0k3r/graby/src/Graby.php:374] Graby\Extractor\ContentExtractor->process() [vendor/j0k3r/graby/src/Graby.php:181] Graby\Graby->doFetchContent() [src/spouts/rss/fulltextrss.php:97] Graby\Graby->fetchContent() [src/spouts/rss/fulltextrss.php:74] spouts\rss\fulltextrss->getFullContent() [src/spouts/Item.php:117] spouts\rss\fulltextrss->spouts\rss\{closure}() [workbench.php:112] spouts\Item->getContent() --- src/Extractor/ContentExtractor.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Extractor/ContentExtractor.php b/src/Extractor/ContentExtractor.php index 393281d7..b274693f 100644 --- a/src/Extractor/ContentExtractor.php +++ b/src/Extractor/ContentExtractor.php @@ -713,12 +713,13 @@ public function getNextPageUrl() /** * Validate and convert a date to the W3C format. * - * @param string $date + * @param string|null $date * * @return string|null Formatted date using the W3C format (Y-m-d\TH:i:sP) OR null if the date is badly formatted */ public function validateDate($date) { + $date = (string) $date; $parseDate = (array) date_parse($date); // If no year has been found during date_parse, we nuke the whole value