Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.6.0+ requires php8.0+ #46

Open
spuniun opened this issue Apr 3, 2023 · 1 comment
Open

1.6.0+ requires php8.0+ #46

spuniun opened this issue Apr 3, 2023 · 1 comment

Comments

@spuniun
Copy link

spuniun commented Apr 3, 2023

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants