• MaxMatthew

    (@maxmatthew)


    This plugin was working fine, and much appreciated! But then suddenly I started getting Illegal String Offset messages:

    Warning: Illegal string offset ‘form_id’ in /xxxxxxx/xxxxxxxxxx/xxxxxxxx/cfs_wp/wp-content/plugins/formidable-honeypot/formidable-honeypot.php on line 86

    Can you help me fix this? I’d rather not use a Captcha

    https://www.ads-software.com/plugins/formidable-honeypot/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I was receiving the same error. The reason this error occurs is because PHP versions 5.4 and above have strict warnings enabled by default. With strict warnings turned on, it will always trigger when there is a an attempt to access a value in an empty array. In this case, the developer is testing for a multi-page form and is accessing an array value that doesn’t exist for single-page forms. I added a check to see if the multi-page arrays exist. Now, it’s fair to warn you that I have not tested this on multi-page forms. I’ve only tested it on single-page forms and it stops the warning messages.

    //don't require if not on the last page
    			global $frm_next_page, $frm_vars;
    			if(!is_array($frm_vars) or !is_array($frm_next_page)) {
    				// do nothing
    			} else {
    				if((is_array($frm_vars) and isset($frm_vars['next_page']) and isset($frm_vars['next_page'][$values['form_id']])) or (is_array($frm_next_page) and isset($frm_next_page[$values['form_id']])))
    					return $errors;
    			}

    This code wraps the developer’s original code in an if statement. Use at your own risk. Remember that if the developer releases another version of the plugin and still hasn’t fixed the warning message, this code will be overwritten.

    Where should the code be put in?

    Thank you SO much for posting this! Works great!

    It goes on the file: formidable-honeypot.php

    around line 89. Replaces the code like so

    //NEW CODE
    //don't require if not on the last page
    			global $frm_next_page, $frm_vars;
    			if(!is_array($frm_vars) or !is_array($frm_next_page)) {
    				// do nothing
    			} else {
    				if((is_array($frm_vars) and isset($frm_vars['next_page']) and isset($frm_vars['next_page'][$values['form_id']])) or (is_array($frm_next_page) and isset($frm_next_page[$values['form_id']])))
    					return $errors;
    			}
    
    		/*ORIGINAL CODE HERE
    		  //don't require if not on the last page
    			global $frm_next_page, $frm_vars;
    			if((is_array($frm_vars) and isset($frm_vars['next_page']) and isset($frm_vars['next_page'][$values['form_id']])) or (is_array($frm_next_page) and isset($frm_next_page[$values['form_id']])))
    				return $errors;
    
    		  	//if the honeypot wasn't incuded on the page
    			if(!isset($_POST['firstname_hnypt'])){
    		        return $errors;
    		    }
    
    		  */

    Great fix. Thank you.

    Someone should pick this back up. I wonder what the process would be for that.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Illegal String Offset’ is closed to new replies.