1

I get periodic errors telling me that something expects a parameter to be an array. But the messages are too vague, and don't tell me which piece of code is feeding that information to Drupal. Here's an example:

Warning: array_keys() expects parameter 1 to be array, null given in inline_conditions_field_widget_form_validate() (line 353 of /Users/newman/Sites/visionart/sites/all/modules/inline_conditions/inline_conditions.field.inc).
Warning: array_filter() expects parameter 1 to be array, null given in inline_conditions_field_widget_form_validate() (line 353 of /Users/newman/Sites/visionart/sites/all/modules/inline_conditions/inline_conditions.field.inc).
Warning: array_flip() expects parameter 1 to be array, null given in inline_conditions_field_widget_form_validate() (line 353 of /Users/newman/Sites/visionart/sites/all/modules/inline_conditions/inline_conditions.field.inc).
Warning: array_intersect_key(): Argument #1 is not an array in inline_conditions_field_widget_form_validate() (line 353 of /Users/newman/Sites/visionart/sites/all/modules/inline_conditions/inline_conditions.field.inc).

Most of these are in connection with array_flip(). I can see that this one in particular is being flagged but inline_conditions, bit it's such a core module that it's impossible to find out what's triggering it. How can I do that and how can I fix?

2 Answers 2

1

BTW, I think you're mistaken, inline conditions isn't a core module. In fact looks like the latest version is 7.x-1.0-alpha7. Also, notice that these are warnings, not errors. It's likely that they won't effect a site set up with production error handling.

The way I've dealt with that is through debugging on copy of the site running in a local environment with xdebug. If you haven't set that up yet there are a bunch of ways you can do it, here's a few:

  • Here's a link for how to do it using Homebrew. That's my reply but read the others there, they've got good info.

  • you can sign up for a free account on Acquia and use their dev desktop software. Here's some info on doing that. (Seems like I'm plugging my own posts, but thats what I know.) I've gotten

  • There's a similar app from Kalamuna called Kalabox that specifically is set up to work with Pantheon, but I was able to get to work standalone. Let me know if you need help with this, I'll try to get time to put more details up.

Be ready to be frustrated getting a local environment with debugging up and running, it takes some doing, but it's well worth the effort.

Once you've got debugging happening, you can put a breakpoint on line line 353 of /sites/all/modules/inline_conditions/inline_conditions.field.inc. If you can reproduce the error, then just hit continue until just before you expect the error to occur. (If you can't, you'll have to do this each time it breakpoint is reached.) From the breakpoint, you'll be able to look at the parameters that are referenced on that line and see what's expected to be an array that isn't. My setup using Netbeans allows me to hop to earlier parts of the code by checking the stack. This will allow you to see just where the parameter was originally set.

Sorry this isn't just an easy answer, but getting yourself set up will be worth it in the long run.

1
  • Just checking in on this old post. FWIW, I've switched from Netbeans to PHPstorm and it's a lot more functional. CONS: Takes a while to get up to speed; it costs a yearly subscription fee. PROS: it gives daily hints which makes it easier to learn; there's good online help built in; every hint you learn makes your programming much easier and faster (NOTE: I get no kickback from PHPStorm.)
    – reedbert
    May 17, 2018 at 1:46
0

This may be related to issues with Commerce discounts (possibly related to AJAX?), if so, make sure you'e using the latest version of Commerce Discount.

Also clear all your caches and re-try. If problem persist, report a bug against the module it-self.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.