Support » Plugin: NextGEN Facebook - Social Meta Tags for Facebook, Google, Pinterest, Twitter & More » Warning: array_key_exists():
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
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)
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?
It’ll show v2.9 for now, until I release the final code as v3.0 this afternoon.
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
Would you mind turning on debugging? It’s an option at the bottom of the NGFB settings page.
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:)
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. 😉
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…
I also tagged v2.4.1 which should fix that array error:
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.
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>
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…
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?
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.
I just installed 3.0 version of the plugin and it solved the problem !
Ah, ok, excellent! Good to hear. 🙂
Hopefully it’ll be smooth sailing from here on. 😉
- The topic ‘Warning: array_key_exists():’ is closed to new replies.