• Minor bug, I was getting this error:

    Warning: Invalid argument supplied for foreach() in wp-content/plugins/types/embedded/includes/custom-types.php on line 428

    Line 428 is:

    $types = get_option(WPCF_OPTION_NAME_CUSTOM_TYPES, array());

    But the get_option wasn’t returning an array, even though an array was specified in the second parameter. I fixed this by forcing the type:

    $types = (array) get_option(WPCF_OPTION_NAME_CUSTOM_TYPES, array());

    Just in case anyone else is having this issue.

    -Michael

    https://www.ads-software.com/plugins/types/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Anonymous User 14808221

    (@anonymized-14808221)

    I can not reproduce that with the current stable Types Plugin version.

    Please elaborate on the Steps that must be taken to produce that error, if it is reproducible

    But I assume this is ether a outdated Types, modified Types or conflicting Software.

    Thank you

    Thread Starter mvandemar

    (@mvandemar)

    It is an unmodified current version of the plugin, and not a conflict.

    I am not the only one who has gotten this error, as evidenced by a search. It appears to be data specific though, where you are apparently assuming that get_option(WPCF_OPTION_NAME_CUSTOM_TYPES, array()) will always be an array but apparently there are cases where it is not. Using “array()” as the second parameter will work if nothing is returned, but if something that is not an array is returned then the error occurs. Forcing the type when setting $types ensures that there are no warnings.

    -Michael

    Anonymous User 14808221

    (@anonymized-14808221)

    Since this seems a edge case we need to analyze this more specifically.

    I do not see any steps to follow to reproduce this, can I therefore ask you to head over to the Types Free Support Forum and provide us with a Site’s Snapshot or Access to a Test Site?

    You can first register here (Free) for the forum.

    We will then analyze this and eventually come top with a solution.

    Thank you for cooperating.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Warning: Invalid argument supplied for foreach()’ is closed to new replies.