Php 8.x support – fix init.gravityform.php
-
Please update lines 476, 477, and 528, 529 so that the following PHP warning is not triggered:
“Trying to access array offset on value of type null in …/plugins/hitsteps-visitor-manager/init.gravityform.php”
Please see this discussion for an explanation of the issue:The parent array $_hs_uid_data_cache needs to validated (in addition to the actual value of the array that is already checked with !isset($_hs_uid_data_cache[round($_POST[
'_hs_uid_data'])])) )This happens because
$cOTLdatais null. Previous versions of PHP may have been less strict on such mistakes and silently swallowed the error / notice while 7.4 does not do this anymore.To check whether
$cOTLdatais null use is_null():is_null($cOTLdata)Which means the line should look something like this:
$len = is_null($cOTLdata) ? 0 : count($cOTLdata['char_data']);However, in case both
$cOTLdataand$cOTLdata['char_data']could not exist, you can useisset()for both at once:
https://stackoverflow.com/questions/59336951/message-trying-to-access-array-offset-on-value-of-type-null$len = !isset($cOTLdata['char_data']) ? 0 : count($cOTLdata['char_data']);
The topic ‘Php 8.x support – fix init.gravityform.php’ is closed to new replies.