Support » Plugin: Toolset Types » [PATCH] Invalid argument in fields.php

  • Resolved flynsarmy

    (@flynsarmy)


    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/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author brucepearson

    (@brucepearson)

    Are you seeing this error with Types 1.2?

    flynsarmy

    (@flynsarmy)

    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.

    Plugin Author brucepearson

    (@brucepearson)

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

    nikkione

    (@nikkione)

    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.

    Srdjan

    (@jozik)

    Thanks, we included fix for this too.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[PATCH] Invalid argument in fields.php’ is closed to new replies.