Stefan83 Posted February 10, 2015 Share Posted February 10, 2015 Hi Can anyone tell me what is wrong with the code below? I'm getting a Warning: Illegal string offset 'redirect' in... error in this line: if (preg_match("/aeid/", $confirmation['redirect'])){ I've just updated php to 5.4 and I get the error when I submit a gravity form for wordpress via ajax function salesmod_confirm_change($confirmation, $form, $lead, $ajax){ if (preg_match("/aeid/", $confirmation['redirect'])){ if (!$_GET['cfn']) { $confirm_id = substr(md5( substr(md5(time()), 0, 16)), 0, 16); gform_update_meta($lead['id'], 'confirmation_id', $confirm_id); } else { $confirm_id = $_GET['cfn']; } $confirmation = array('redirect' => $confirmation['redirect'] . "&cfn=" . $confirm_id); } return $confirmation; } Thanks Link to comment https://forums.phpfreaks.com/topic/294507-illegal-string-offset-error/ Share on other sites More sharing options...
AbraCadaver Posted February 10, 2015 Share Posted February 10, 2015 $confirmation is a string and not an array at that point. If you did $confirmation[0] it would give you string offset 0 which is the first character of the string, but there is no redirect offset in a string. Link to comment https://forums.phpfreaks.com/topic/294507-illegal-string-offset-error/#findComment-1505360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.