WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Facebook: Advanced Optimization for All Social Websites
[resolved] Invalid argument supplied for foreach() (16 posts)

  1. zagir
    Member
    Posted 1 year ago #

    Warning: Invalid argument supplied for foreach() in wp-content/plugins/nextgen-facebook/lib/head.php on line 105

    http://wordpress.org/extend/plugins/nextgen-facebook/

  2. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Well that's an odd one... Hm. Any chance you could turn on debug mode (see sticky post) and give me an example URL?

    Thanks,

    js.

  3. zagir
    Member
    Posted 1 year ago #

    http://beta.mojabizuteria.pl/kolczyki-2/kolczyki-ze-swarovskim/
    and refresh

  4. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks, but I thik you turned on just WP's debug mode, not the plugin's. The sticky post I was referring to is: http://wordpress.org/support/topic/please-read-before-posting-2?replies=3

    If you add the following to your wp-config.php file, we should be good to go:

    define('WP_DEBUG', true);
    if ( defined('WP_DEBUG') ) {
            define('WP_DEBUG_LOG', true);
            define('WP_DEBUG_DISPLAY', false);
            @ini_set('display_errors',0);
    }
    
    define('NGFB_DEBUG', true);
    define('NGFB_WP_DEBUG', true);

    Thanks,

    js.

  5. zagir
    Member
    Posted 1 year ago #

    now I do not see any error ??

  6. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    That's on purpose, so that error messages don't pollute the webpage. The errors are being saved to wp-content/debug.log. If you do a View Source on the page, you'll also see that NGFB adds quite a few comments now. ;-)

    js.

  7. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Well, this is a bit of a mystery... The array of Open Graph tags looks good, and yet PHP's foreach() doesn't loop through the whole array. Very odd.

    I'd added more debug logging in that section, if you'd like to download and install the current DEV version from http://downloads.wordpress.org/plugin/nextgen-facebook.zip. That should (hopefully) give me an idea of what's going on...

    Thanks,

    js.

  8. zagir
    Member
    Posted 1 year ago #

    uploaded :)

  9. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Well, this is interesting... Here's the problem:

    There are only two header tags:

    <meta name="generator" content="NGFB Open Graph+ 6.2-dev2" />
    <link rel="author" href="http://plus.google.com/+Korallo" />

    And yet the debug info is showing that it's printing all of them:

    ngfbHead                  :: html                     : 15 html_tags to process
    	ngfbHead                  :: html                     : formatting 1st-dimension element: fb:admins
    	ngfbHead                  :: html                     : formatting 1st-dimension element: fb:app_id
    	ngfbHead                  :: html                     : formatting 1st-dimension element: og:locale
    	ngfbHead                  :: html                     : formatting 1st-dimension element: og:site_name
    	ngfbHead                  :: html                     : formatting 1st-dimension element: og:url
    	ngfbHead                  :: html                     : formatting 1st-dimension element: og:title
    	ngfbHead                  :: html                     : formatting 1st-dimension element: og:description
    	ngfbHead                  :: html                     : foreach 1st-dimension element: og:video (array)
    	ngfbHead                  :: html                     : foreach 1st-dimension element: og:image (array)
    	ngfbHead                  :: html                     : foreach 2nd-dimension element: 0 (array)
    	ngfbHead                  :: html                     : formatting 3rd-dimension element: og:image
    	ngfbHead                  :: html                     : formatting 3rd-dimension element: og:image:cropped
    	ngfbHead                  :: html                     : formatting 3rd-dimension element: og:image:height
    	ngfbHead                  :: html                     : formatting 3rd-dimension element: og:image:width
    	ngfbHead                  :: html                     : formatting 1st-dimension element: og:type
    	ngfbHead                  :: html                     : formatting 1st-dimension element: article:author
    	ngfbHead                  :: html                     : foreach 1st-dimension element: article:tag (array)
    	ngfbHead                  :: html                     : formatting 2nd-dimension element: 0
    	ngfbHead                  :: html                     : formatting 2nd-dimension element: 1
    	ngfbHead                  :: html                     : formatting 2nd-dimension element: 2
    	ngfbHead                  :: html                     : formatting 1st-dimension element: article:section
    	ngfbHead                  :: html                     : formatting 1st-dimension element: article:modified_time
    	ngfbHead                  :: html                     : formatting 1st-dimension element: article:published_time

    I suspect that another plugin is misbehaving and leaving the output buffer open -- that's a but no-no, and creates issues like this.

    I've added an ob_end_flush() command, which should close any lingering output buffer. This should, hopefully, fix the issue. Would you mind downloading and re-installing the DEV version again?

    Thanks,

    js.

  10. zagir
    Member
    Posted 1 year ago #

    done

  11. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Well, struck out on that idea... I added more debug code to see what the actual values (that are supposed to be echoed) are. Would you mind downloading and installing the DEV version *again*? ;-)

    Thanks,

    js.

  12. zagir
    Member
    Posted 1 year ago #

    new version on server

  13. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, wait a minute, am I missing something here? You seem to have disabled pretty much all the meta tags...

    ngfbHead                  :: get_meta_html            : meta fb:admins is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta fb:app_id is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:locale is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:site_name is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:url is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:title is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:description is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:image is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:image:cropped is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:image:height is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:image:width is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta og:type is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta article:author is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta article:tag is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta article:tag is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta article:tag is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta article:section is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta article:modified_time is disabled - skipping
    	ngfbHead                  :: get_meta_html            : meta article:published_time is disabled - skipping

    The original error was "Warning: Invalid argument supplied for foreach() in wp-content/plugins/nextgen-facebook/lib/head.php on line 105". The foreach() in that error prints out those meta tags -- if none are enabled, then debugging the error is a little more of a challenge. ;-)

    Not a problem though -- that foreach() still shouldn't give an error, especially since it appears to be working. ;-)

    Can you still see the same error in the debug.log?

    BTW, you can set NGFB_DEBUG to false and leave NGFB_WP_DEBUG to true in order to cut down on the output shown in the debug.log. ;-)

    Thanks,

    js.

  14. zagir
    Member
    Posted 1 year ago #

    I'm sorry so late
    code
    was changed for:

    define('WP_DEBUG', true);
    if ( defined('WP_DEBUG') ) {
            define('WP_DEBUG_LOG', true);
            define('WP_DEBUG_DISPLAY', false);
            @ini_set('display_errors',0);
    }
    
    define('NGFB_DEBUG', false);
    define('NGFB_WP_DEBUG', true);
  15. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Are you still seeing the "Warning: Invalid argument supplied for foreach() in wp-content/plugins/nextgen-facebook/lib/head.php on line 105" error in the debug.log?

    Thanks,

    js.

  16. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Well, considering I couldn't find any errors when looking at your website, and you still haven't/can't confirm that you're still seeing that foreach() warning, I will close this thread.

    js.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.