WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Facebook: Advanced Optimization for All Social Websites
[resolved] Warning: array_key_exists(): (19 posts)

  1. knutsson
    Member
    Posted 1 year ago #

    I get this message when I activate the plugin, in the header.

    Warning: array_key_exists(): The second argument should be either an array or an object in wp-content/plugins/nextgen-facebook/nextgen-facebook.php on line 277

    Whats wrong?

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

  2. theshae
    Member
    Posted 1 year ago #

    I'm getting the same error on a fresh install running 2012 theme

  3. RMJ
    Member
    Posted 1 year ago #

    Possibly related error but I updated my plugin (from dev version) to public 2.4 and I'm getting this error:

    0 is a protected WP option and may not be modified

    The plugin won't activate anymore. I even tried to delete it and re-install but same thing happens. Instlalling older version works just fine.

    (I did not see the array error anywhere even turned on WP debug info. Just some notices of undefined variables related to this plugin)

  4. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you for letting me know. I'm just finishing up a major update and will be releasing v3.0 this afternoon.

    Line 277 in v2.4 refers to a section that checks to see if all the options exist, and if one doesn't (in case of an update, for example), it creates it with a default value.

    foreach ( $this->default_options as $opt => $def )
        if ( ! array_key_exists( $opt, $opts ) ) $opts[$opt] = $def;

    This section of code, like pretty much all the rest of the code, has been revised. That specific line hasn't changed much, except that I've added a check to make sure the associative key has a value.

    foreach ( $this->default_options as $def_key => $def_val )
        if ( $def_key && ! array_key_exists( $def_key, $opts ) )
            $opts[$def_key] = $def_val;

    If you wouldn't mind, could you give the DEV version a spin?

    http://downloads.wordpress.org/plugin/nextgen-facebook.zip

    It'll show v2.9 for now, until I release the final code as v3.0 this afternoon.

    Thanks,

    js.

  5. knutsson
    Member
    Posted 1 year ago #

    The Warning has gone away, but in my theme I cant get the meta tags to show. But in the standard Twentyelven it works fine.

    you can check my site at kmagazine.se

  6. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Hm. Ok...

    Would you mind turning on debugging? It's an option at the bottom of the NGFB settings page.

    Thanks,

    js.

  7. knutsson
    Member
    Posted 1 year ago #

    I have done it, but you have to check at http://www.eypaco.se beacuse the other page I dont want to mess with so much:)

  8. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    BTW, if you take a look at your HTML source, there are a few issues...

    - You should remove those blank lines before the !DOCTYPE.

    - There's a <div id="fb-root"></div> in the head section -- that's a no-no.

    - The first anchor <a href="http://kmagazine.se" rel="bookmark" class="linklogo"/> shouldn't have a "/" at the end there...

    - You have nested <header> tags, which is a no-no in HTML5.

    You may want to run your website through the W3 validator. ;-)

    js.

  9. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Can you download and try-out the latest DEV version again? I've added a little more debug info - specifically to see if wp_head() and wp_footer() are available... When in debug mode, you should see the following:

    * First line of your page:

    <!-- NextGEN Facebook OG 2.9 Plugin Loaded -->

    * As the first and last lines in your header:

    <!-- NextGEN Facebook OG wp_head() Test : Priority 1 = Passed -->
    <!-- NextGEN Facebook OG wp_head() Test : Priority 9999 = Passed -->

    * And at the bottom of your page, in the footer section:

    <!-- NextGEN Facebook OG wp_footer() Test : Priority 1 = Passed -->
    <!-- NextGEN Facebook OG wp_footer() Test : Priority 9999 = Passed -->

    Let's start with that and see if that works. I'll probably add hooks to other WP functions to help debug situations like this...

    Thanks,

    js.

  10. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    I also tagged v2.4.1 which should fix that array error:

    http://downloads.wordpress.org/plugin/nextgen-facebook.2.4.1.zip

    I was hoping to release v3.0 this afternoon -- it's been rock solid for me, and tested on several different websites -- but I'd like to get this odd non-running plugin issue solved before. ;-)

    Let me know if you get a little farther with v2.9.

    Thanks,

    js.

  11. RMJ
    Member
    Posted 1 year ago #

    I still get the error with the dev version. It kills the whole page, all I get is (minus header):

    <body id="error-page">
    	<p>0 is a protected WP option and may not be modified</p>
    </body>
  12. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    It would help to know which line the problem is on... Do you have access to the server's logs? The error log should have more info.

    BTW, I released v3.0 last night, and the DEV version is now an in-progress v3.1. Not many changes, except adding goo.gl as an URL shortener for Twitter (though that code is not complete yet).

    Would you mind using the stable v3.0 code and letting me know what line number is tripping up WP?

    BTW, what version of PHP are you using? I'll have to check into known bugs for the version you're using...

    Thanks,

    js.

  13. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    @RMJ,

    flokohlert reported the same issue in another support thread. A little research seems to suggest this might be related to a MultiUser environment issue. There are a number of bug reports, but the reports themselves have vanished. Which version of WP are you running?

    Thanks,

    js.

  14. RMJ
    Member
    Posted 1 year ago #

    I'm running the newest version of WP.

    And I cannot give any line number since it's not a PHP error. I turned on debug on in WP also but I get nothing useful.

    2.3.1 (dev) version of the plugin is working just fine. After that it breaks.

    ANYWAYS...

    I just installed 3.0 version of the plugin and it solved the problem !

  15. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, ok, excellent! Good to hear. :)

    Hopefully it'll be smooth sailing from here on. ;-)

    Thanks,

    js.

  16. DenisBY
    Member
    Posted 1 year ago #

    I just installed 3.0 to wp 3.5 and have this at the top of my page:
    Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/htpc.by/wp/wp-content/plugins/nextgen-facebook/nextgen-facebook.php on line 290

  17. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Aha! Found it!

    For some reason, the default options did not get defined on activation, or something happened to the options at some point. When an active plugin uses WP's get_option() function, WP returns false if it doesn't find anything. Since NGFB's options are one big array, that's a problem -- can't go handling an array if get_option() returns a string. ;-)

    I could pass a default value to get_option(), but I chose to test the result afterwards, just in case. :)

    I might look into displaying a warning message if get_option() doesn't return anything for an **active** plugin. That just shouldn't happen...

    Anyway, you can download the current dev version and everything should be good. ;-)

    http://downloads.wordpress.org/plugin/nextgen-facebook.zip

    Thanks,

    js.

  18. DenisBY
    Member
    Posted 1 year ago #

    yes, now it works. thanks!

  19. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    NP. ;-)

    I just finished adding a warning message to the dev version when this happens. :)

    js.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.