From 04be85996d2567af4798f5dcda3db50745e899c5 Mon Sep 17 00:00:00 2001 From: Christian Archer Date: Thu, 24 Oct 2019 22:57:14 +0300 Subject: [PATCH] [BastaBridge] Fix PHP 7.4 crash (#1323) * Inline the function --- bridges/BastaBridge.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bridges/BastaBridge.php b/bridges/BastaBridge.php index f528aea0..613005fd 100644 --- a/bridges/BastaBridge.php +++ b/bridges/BastaBridge.php @@ -8,12 +8,6 @@ class BastaBridge extends BridgeAbstract { const DESCRIPTION = 'Returns the newest articles.'; public function collectData(){ - // Replaces all relative image URLs by absolute URLs. - // Relative URLs always start with 'local/'! - function replaceImageUrl($content){ - return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\'' . self::URI . '$1\'', $content); - } - $html = getSimpleHTMLDOM(self::URI . 'spip.php?page=backend') or returnServerError('Could not request Bastamag.'); @@ -25,7 +19,13 @@ class BastaBridge extends BridgeAbstract { $item['title'] = $element->find('title', 0)->innertext; $item['uri'] = $element->find('guid', 0)->plaintext; $item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext); - $item['content'] = replaceImageUrl(getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext); + // Replaces all relative image URLs by absolute URLs. + // Relative URLs always start with 'local/'! + $item['content'] = preg_replace( + '/src=["\']{1}([^"\']+)/ims', + 'src=\'' . self::URI . '$1\'', + getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext + ); $this->items[] = $item; $limit++; }