Jump to content

Recommended Posts

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

$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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.