WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] [PATCH] Invalid argument in fields.php (6 posts)

  1. flynsarmy
    Member
    Posted 1 year ago #

    With WP_DEBUG on I'm getting a couple of warnings on my WP admin dashboard.

    Warning: Invalid argument supplied for foreach() in /path/to/wp-content/plugins/types/embedded/includes/fields.php on line 76

    This is the line in question:

    foreach ( $fields as $k => $v ) {

    I did a var_dump($fields) and it looks like a false boolean was being passed. Simple fix is to add the line:

    if ( is_array($fields) )

    above the foreach.

    Second was:

    Warning: Invalid argument supplied for foreach() in /path/to/wp-content/plugins/types/embedded/classes/conditional.php on line 82

    which is

    foreach ( $fields->fields->all as $f_id => $f ) {

    Again, all is a false boolean so I added

    if ( is_array($fields->fields->all) )

    above the foreach.

    http://wordpress.org/extend/plugins/types/

  2. brucepearson
    Member
    Plugin Author

    Posted 1 year ago #

    Are you seeing this error with Types 1.2?

  3. flynsarmy
    Member
    Posted 1 year ago #

    Yes. My guess is I have a field group with no fields. Haven't checked to confirm yet. Just wanted to get rid of the warnings so I wrote the patch.

  4. brucepearson
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks, we'll include this in the next release that will be out soon.

  5. nikkione
    Member
    Posted 1 year ago #

    I have the same problem with types 1.2 wp3.5.1 and php 5.4!!
    and one more:

    Warning: Invalid argument supplied for foreach() in /path/wp-content/plugins/types/embedded/admin.php on line 423

    this is the line in question
    foreach ( $messages_for_user as $message_id => $message ) {
    i added
    if ( is_array($messages_for_user) )
    above the foreach, and all works.

    Thanks, flynsarmy for fix and help.

  6. Srdjan
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks, we included fix for this too.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.