deliciousbrains / wp-offload-ses-lite

WP Offload SES Lite sends all outgoing WordPress emails through Amazon Simple Email Service (SES) instead of the local wp_mail() function.
https://wordpress.org/plugins/wp-ses/
14 stars 11 forks source link

1.6.0+ requires php8.0+ #46

Open spuniun opened 1 year ago

spuniun commented 1 year ago

FYI, with the update to 1.6.0 there is a plugin dependency in vendor/Carbon/Traits/Creator.php on php8.0+. Function str_contains() was not introduced until php8.0 so that call on line 75 has to be removed/rewritten if you truly want to support php7+ as the current README claims. Otherwise you'll need to update your requirements for the plugin. Thanks.

`PHP Fatal error: Uncaught Error: Call to undefined function str_contains() in /var/www/html/wp-content/plugins/wp-ses/vendor/Carbon/Traits/Creator.php:75 Stack trace:

0 /var/www/html/wp-content/plugins/wp-ses/vendor/WP-Queue/Connections/DatabaseConnection.php(166): DeliciousBrains\WP_Offload_SES\Carbon\Carbon->__construct('2023-03-20 03:5...')

1 /var/www/html/wp-content/plugins/wp-ses/classes/Queue/Connection.php(160): DeliciousBrains\WP_Offload_SES\WP_Queue\Connections\DatabaseConnection->vitalize_job(Object(stdClass))

2 /var/www/html/wp-content/plugins/wp-ses/classes/Queue/Worker.php(56): DeliciousBrains\WP_Offload_SES\Queue\Connection->pop()

3 /var/www/html/wp-content/plugins/wp-ses/classes/Queue/Email-Cron.php(60): DeliciousBrains\WP_Offload_SES\Queue\Worker->process()

4 /var/www/html/wp-includes/class-wp-hook.php(303): DeliciousBrains\WP_Offload_SES\Queue\Email_Cron->cron_worker()

5 /var/www/html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)

6 /var/www/html/wp-includes/plugin.php(518): WP_H in /var/www/html/wp-content/plugins/wp-ses/vendor/Carbon/Traits/Creator.php on line 75

`

eriktorsner commented 1 year ago

Hi @spuniun,

Thanks for reporting this. Yes, the Carbon library does use the str_contains() function in a few places, and just as you point out, this function was introduced in PHP 8.0. Worth noting is that WordPress itself added a polyfill for str_contains() back in version 5.9 so any version after that also works.

So as things stand right now, this plugin requires either PHP 8.0+ OR WordPress 5.9+. This was not intentional on our behalf and we will correct it as soon as possible.

Assuming you are using WordPress 5.8 or earlier and need to fix this before we get a new release out. Your best option is to upgrade to WordPress 5.9 or later. If you absolutely can't upgrade, you could try adding the polyfill yourself, This gist has a good implementation. Just note that we can't provide any support for that and we really recommend upgrading WordPress or waiting for our fix.

Again, thanks for bringing this to our attention.