WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Warning: array_key_exists():

[Resolved] Warning: array_key_exists():

Viewing 15 replies - 1 through 15 (of 18 total)
  • I’m getting the same error on a fresh install running 2012 theme

    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)

    Plugin Author JS Morisset
    Participant

    @jsmoriss

    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.

    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

    Plugin Author JS Morisset
    Participant

    @jsmoriss

    Hm. Ok…

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

    Thanks,

    js.

    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:)

    Plugin Author JS Morisset
    Participant

    @jsmoriss

    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.

    Plugin Author JS Morisset
    Participant

    @jsmoriss

    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.

    Plugin Author JS Morisset
    Participant

    @jsmoriss

    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.

    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>
    Plugin Author JS Morisset
    Participant

    @jsmoriss

    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.

    Plugin Author JS Morisset
    Participant

    @jsmoriss

    @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.

    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 !

    Plugin Author JS Morisset
    Participant

    @jsmoriss

    Ah, ok, excellent! Good to hear. 🙂

    Hopefully it’ll be smooth sailing from here on. 😉

    Thanks,

    js.

    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

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Resolved] Warning: array_key_exists():’ is closed to new replies.