Support

Account

Home Forums General Issues Stray Field (blank field no label)

Solved

Stray Field (blank field no label)

  • Hello,
    I have flex content field that contains several elements. at the bottom of one of these I have a strange blank field (text field) that doesn’t have a label. if I look at the id it’s:

    acf-field_550090909361f-58828962b9f20-field_55009487c0377-58828963b9f21-field_55009612c037a-58828966b9f22-field_5508921ee1487-58828968b9f23-

    looking at another field in that element there should be one more key in that string (assuming that this string is sorta like an array of the parent keys, so I’m figuring the last would be the the fields actual key). I’m figuring something went wrong and I’ll have to make some manual edits to the DB…but without the key I’m not sure how to go about doing that.

    Any help would be appreciated. Thanks!

  • I’m guessing that the field does not have a key as well as not having a name.

    What version of ACF are you using? 4 and 5 store fields differently so looking for it will be different depending on the version.

  • I’d start by looking in the db in the posts table, post_type = acf-field and post_name with no value.

  • dang, I actually don’t have any. I’m importing from a php file. I’ve attached the file. It’s pretty big but I place a comment:

    //
    //================================
    // CARD 
    //================================

    This is the element that is giving me problems. The fields shows at the bottom of this field set.

  • The file did not attach, try compressing it into a .zip first

  • whoops second try

  • Going to be honest with you, I looked that over and did not see anything that jumps out as a problem.

  • I did notice that I’m getting these errors in my logs:

    [Sat Jan 21 12:56:04.473282 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 361, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473335 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent_layout' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 362, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473347 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 361, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473354 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent_layout' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 362, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473667 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'type' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 289, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473675 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'type' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 318, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473690 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'type' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 289, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473698 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'type' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 318, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473876 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/core/local.php on line 322, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473888 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'menu_order' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/core/local.php on line 173, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473895 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/core/local.php on line 322, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473900 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'menu_order' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/core/local.php on line 173, referer: http://CLIENT_NAME.dev/health/

    Also worth noting how this all came about is I have a acf file that I use for all my themes and for the most part it works fine across the board but for this client I needed to add something to a repeater the file. so I created that card element, then exported, and then copy and pasted it in between those comments. so maybe there is something that need to change elsewhere?

  • Okay so I have no idea what I’ve done but that field went away. It was still there this weekend, but it’s not there now…no idea, and sorry for any headaches.

    but my logs are quickly filling up with those errors I mentioned above, any idea what those are all about? they happen when I hit the front end and also while editing in that admin. In the admin they get error every couple seconds so like I said my logs are busting at the seams.

    edit: if I comment out the “card” code the errors stop so it’s definitely having to do with that. There is probably something else I need to edit to add that to that repeater.

  • There’s not way for me to tell exactly what’s causing those errors from looking at the log.

    I can say this, that the errors are caused by missing arguments when adding a field.

    Everywhere is says

    Illegal string offset '???????'

    Whatever is inside the quotes means that some field somewhere is missing that argument when ACF is trying to create it.

  • Thanks for the info and all your attention. I started debugging. I went to /wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php and into the flex_content block (around line 350) and entered:

    // loop over sub fields
    foreach( array_keys($sub_fields) as $j ) {
    	
    	// extract sub field
    	$sub_field = acf_extract_var( $sub_fields, $j );
    	echo '============ start ============= <br />';
    	var_dump('SUB_FIELD KEY: ' . $sub_field['key']);
    	echo '<br />';
    	var_dump('SUB_FIELD LABEL: ' . $sub_field['label']);
    	echo '<br />';
    	var_dump('SUB_FIELD TYPE: ' . $sub_field['type']);
    	echo '<br />';
    	var_dump('FIELD_KEY: ' . $field['key']);
    	echo '<br />';
    	
    	// attributes
    	$sub_field['parent'] = $field['key'];
    	var_dump('SUBFIELD_PARENT: ' . $sub_field['parent']);
    	echo '<br />';
    	$sub_field['parent_layout'] = $layout['key'];
    	if(empty($sub_field['parent']))
    	{
    		echo '== PARENT EMPTY - Printing $sub_fields ==<br />';
    		echo '<pre>'; print_r($sub_fields);
    	}
    	echo '<br />============ end ============= <br />';
    	echo '<br />';
    	
    	// append to extra
    	$extra[] = $sub_field;
    	
    }

    The output I got was pretty strange. I have a lot of fields in that flex content – all were outputting correctly and then there were two “mystery arrays” at the end that were empty or mostly empty (one just had a “max” key).

    ...
    
    ============ start =============
    string(34) "SUB_FIELD KEY: field_5880edb261233"
    string(24) "SUB_FIELD LABEL: Heights"
    string(21) "SUB_FIELD TYPE: radio"
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(36) "SUBFIELD_PARENT: field_5508921ee1487"
    
    ============ end =============
    
    ============ start =============
    string(34) "SUB_FIELD KEY: field_5880eef761234"
    string(29) "SUB_FIELD LABEL: Fixed Height"
    string(22) "SUB_FIELD TYPE: number"
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(36) "SUBFIELD_PARENT: field_5508921ee1487"
    
    ============ end =============
    
    ============ start =============
    string(15) "SUB_FIELD KEY: "
    string(17) "SUB_FIELD LABEL: "
    string(16) "SUB_FIELD TYPE: "
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(18) "SUBFIELD_PARENT: f"
    == PARENT EMPTY - Printing $sub_fields ==
    
    Array
    (
        [max] => 
    )
    
    ============ end ============= 
    
    ============ start ============= 
    string(15) "SUB_FIELD KEY: "
    string(17) "SUB_FIELD LABEL: "
    string(16) "SUB_FIELD TYPE: "
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(18) "SUBFIELD_PARENT: f"
    == PARENT EMPTY - Printing $sub_fields ==
    
    Array
    (
    )
    
    ============ end ============= 

    You might have also notice that the subfield['parent'] value is f. super weird since all it’s doing is assigning the field key to it which is displaying the correct value. I’m also not even sure how we are getting here on this last one because the array is clearly empty and we have this if statement to protect against this !empty($sub_fields).

    I’m was thinking the way it’s cutting off on the subfield parent maybe it was due to that max_input_var limit in php, I upped that to 3000 and still getting the same results. I’m running php 7.1, any ideas?

  • Or it could be another PHP setting, but I don’t know which. There are several PHP settings I think that deal with the length of the input and the time it takes php to parse the input.

  • John I just wanted to thank you for all your help with this issue. I think I managed to fix it. Anyone else (unlikely but you never know) with this issue I had a mistake in my acf.php I had “min” and “max” as a child of the sub_fields array when they need to be siblings.

    // so this - WRONG
    ...
    "sub_fields" => array (
    	...
    	array (
    		'tabs' => 'all',
    		'toolbar' => 'full',
    		'media_upload' => 1,
    		'default_value' => '',
    		'delay' => 0,
    		'key' => 'field_5880eb5f6122e',
    		'label' => 'Text',
    		'name' => 'the_text',
    		'type' => 'wysiwyg',
    		'instructions' => '',
    		'required' => 0,
    		'conditional_logic' => 0,
    		'wrapper' => array (
    			'width' => '',
    			'class' => '',
    			'id' => '',
    		),
    	),
    	'min' => '',
    	'max' => '',
    ),
    
    // to this - RIGHT
    ...
    "sub_fields" => array (
    	...
    	array (
    		'tabs' => 'all',
    		'toolbar' => 'full',
    		'media_upload' => 1,
    		'default_value' => '',
    		'delay' => 0,
    		'key' => 'field_5880eb5f6122e',
    		'label' => 'Text',
    		'name' => 'the_text',
    		'type' => 'wysiwyg',
    		'instructions' => '',
    		'required' => 0,
    		'conditional_logic' => 0,
    		'wrapper' => array (
    			'width' => '',
    			'class' => '',
    			'id' => '',
    		),
    	),
    ),
    'min' => '',
    'max' => '',

    VICTORY! Thanks again for all your help!

  • That would probably do it. Looking at many fields it would be easy to miss. I should have suggested trying to add one field group at a time until you found the one causig the problem and then one field at a time. Would have let you narrow it down. But I didn’t think of the debugging method until just now.

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.