Proposed Patch: PHP 8.x Fatal Server Error When Authenticating FB
-
This also affects the paid Flow-Flow plugin on CodeCanyon.
Currently, I have a site on PHP 8.0.x where it was encountering a fatal server error when returning back from Facebook when trying to authenticate & get a new token for FB & Instagram.
It turns out that
includes/db/FFDBManager.php
currently has:$facebook_cache->save($_REQUEST['facebook_access_token'], time() + $_REQUEST['expires']);
within the
social_auth
function that’s triggering a TypeError.This was fixed by changing this line into:
$facebook_cache_time = time() + intval($_REQUEST['expires']); $facebook_cache->save($_REQUEST['facebook_access_token'], $facebook_cache_time);
It technically might not be required to break the variable out of the function, but I did want to isolate that calculation to not be performed within the save function’s parameters, but this should make it more reliable overall.
The key change was the fact that
$_REQUEST['expires']
is nowintval($_REQUEST['expires'])
. The TypeError was due totime()
(an integer) being added to$_REQUEST['expires']
(a string), and newer PHP versions don’t auto-convert types in cases like this sointval
is used to take care of that.I’d love to see this included in a future version of both this & the paid version of Flow-Flow (with the issue present for both [actually encountered this with the paid plugin first.])
- You must be logged in to reply to this topic.