ChrisRAoW / mautic-rss-to-email-bundle

Mautic plugin to send emails from RSS
103 stars 23 forks source link

Not compatible with PHP 8 #70

Closed ttencate closed 1 year ago

ttencate commented 1 year ago

[2022-12-20 09:29:41] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "implode(): Argument #2 ($array) must be of type ?array, string given" at /var/www/vhosts/mautic.veganchallenge.nl/httpdocs/plugins/MauticRssToEmailBundle/vendor/simplepie/simplepie/library/SimplePie/Parse/Date.php line 544 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): implode(): Argument #2 ($array) must be of type ?array, string given at /var/www/vhosts/mautic.veganchallenge.nl/httpdocs/plugins/MauticRssToEmailBundle/vendor/simplepie/simplepie/library/SimplePie/Parse/Date.php:544)"}

The reverse order of implode() arguments was finally removed in PHP 8. This looks like https://github.com/simplepie/simplepie/issues/718 in SimplePie, which was fixed in 1.5.3, but MauticRssToEmailBundle still has 1.5.2 in its composer.lock file.

Updating simplepie should suffice.

ChrisRAoW commented 1 year ago

@ttencate Thanks for letting me know. Will check if I can update simplepie to latest version which is 1.7 at the moment.

regularguy01 commented 1 year ago

version 1.5.7 works fine.

ChrisRAoW commented 1 year ago

@bdacus01 I just updated the bundled Simpliepie version to version 1.5.8

regularguy01 commented 1 year ago

Thanks.
Note of use: I am using the plugin on mautic 4.45. Seems to work fine. I only can't get images to come in. I am getting rss from the latest wordpress feed. So it could be an issue there. Thanks for all of this work!

ChrisRAoW commented 1 year ago

@bdacus01 By default wordpress is not including the images in the rss feed. You need an extra plugin for that that add a media or enclosure tag to the items in the feed.

regularguy01 commented 1 year ago

Just put this in my functions.php of my child theme. Works brilliant thanks again... Hit me up if you need testing help.

function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}

add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');