The (temporary) fix until there’s a patch issued by the developer is to change line 1687 of /includes/class-api.php
FROM:
$expiration_time = $issued_time + $expires_in;
TO:
$expiration_time = (int) $issued_time + (int) $expires_in;
the code doesn’t currently ensure that the strings are cast as integers.
What PHP version are both of you on?
Asking because that specific line hasn’t been changed since version 2.2.0 was released, but I know we did a required PHP upgrade with 2.15.0 which I could see causing an changed thrown error like this.
I’m running PHP 8.4. Since PHP 8 no longer allows string + string operations and WordPress stores option values as strings, the operands need to be cast to integers. The fix above works universally for PHP 8.0+. It’s a plugin-side type-safety issue rather than an environment issue.
Definitely willing to patch things up on the plugin side, at the same time though I’m curious why it just suddenly came up as my local is running 8.4 as well, and no issue here. Regardless, better safe than sorry with this and getting things matching.
My *guess* is that since this function is called access_token_maybe_expired(), it only gets called in certain scenarios. I know that in our case, the plugin was installed by a previous dev, and there’s no indication in our docs anywhere of what account he used to register the plugin, or if it was registered by the client because he had granted the client an admin role.
We’ve had the Constant Contact Forms has detected errors that indicate a need to manually disconnect and reconnect your Constant Contact account. Visit the Connection Settings to manage. message for a while now, but we can’t disconnect and reconnect because we have no indication of what the account should be.
The site where we’re using this plugin has already signed on for a rebuild, and we’ll likely end up using a different solution for the forms than what he used so that we can maintain consistency with our other sites.
I’m running php8.3.
I did a complete troubleshooting test in my dev environment. I can recreate the problem with 2025 theme and no other plugins installed. …but, I’m still able to use it on another site of mine, so rather odd.
Also, it works as expected with any previous version.
Am I reading these other posts correctly, in that it’s the way the connection is made from the user and the API? I must be misunderstanding that…
-
This reply was modified 5 months, 2 weeks ago by
splaquet.
To be clear, the issue only happens when that function is called. What exactly triggers the function call, I couldn’t say for sure – I’m just a user. Considering it’s a function called access_token_maybe_expired() and it’s in /includes/class-api.php, logically, I would assume that the function is called upon authentication (or lack thereof) to an API.
The only place I’m seeing the method in question is if DISABLE_WP_CRON is defined and set to true.
https://github.com/WebDevStudios/constant-contact-forms/blob/2.15.1/includes/class-api.php#L218-L220
So it’s part PHP version, but also part edge case with regards to WP Cron.
We ran into this today, on a DreamPress (managed WordPress) site with PHP 8.4. We have DISABLE_WP_CRON defined and enabled (true).
Thank you, @spatton99, for the temporary fix!
Hoping to provide a downloadable zip to help patch this up for those encountering immediate issues, by end of day today, with a patched release to everyone early next week.
Thank you for your patience and understanding with this slight edge case.
For until we get a release out to everyone: https://www.dropbox.com/scl/fi/pfahvxzo5xx620f7st2q2/constant-contact-forms-2152-beta.zip?rlkey=oma9azvsyfw5p4bne0bgo9g0m&dl=0
It’ll still say “2.15.1” but the casting of integers for the math, instead of potential strings and concatenation is in place.