I am trying to write a SimpleTest that covers a feature that uses ECK. The feature includes exported ECK components and the notice appears during the module install phase of the test. This notice didn't happen with rc2 but occurs in rc3 and current -dev. This is perhaps similar to #1365602: "Warning: array_keys() expects parameter 1 to be array," on module install?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

func0der’s picture

Got the same problem here.

With my current installation with Panles enabled and some other modules I get a white page, so this really needs a fix.

Aside from this, this always causes a warning if your cache_eck table is empty and the site is loaded.

This can easily happen if you are using memcache or something similar and the entry gets kicked out due to evictions.

I can not find a way to fix this, so please, someone with more code insight get to this.

Greetings
func0der

joelpittet’s picture

I wonder since this recently went in and it has to do with the schema, that maybe they are related?
#1186552-25: Support Revisions in ECK

@longwave could you try this test you wrote again and see if it's still happening? And also if so, maybe a stack trace or breakpoint inside drupal_schema_fields_sql(). would give a few more hints

fmizzell’s picture

Status: Active » Postponed (maintainer needs more info)

I can see the warnings when running the behat tests, but when trying to get the warning while using ECK through the UI I've had no luck. Also I have not noticed the warning causing a WSOD. I've tried clearing the cache_eck table as suggested by @func0der without luck.

I am planning on trying memcache to see if I can get results like the ones pointed in this issue: #2268113: Error messages on enabling memcache/memcache_storage.

I am going to change the status of this issue until one of us can point out specific steps to reproduce this problem so we can try to fix it.

fmizzell’s picture

Version: 7.x-2.0-rc3 » 7.x-2.x-dev
joelpittet’s picture

Also, this may fix it #2309321: Optimize code by using empty or isset instead of array_key_exists because I've made sure !empty() is used in every place array_key_exists() so we can avoid NULL values and it's faster due to the implicit isset() check than array_key_exists.

func0der’s picture

I did not recognized it at first, but you released a new version. (Great :))
I tried to use the newest version (7.x-2.x-rc4).

I can not reproduce this problem in the current stable 7.x-2.x-rc4 version.

If I follow my procedure, which is described above, the page does not go down.
It does not rebuild the "bundle" cache in the `cacke_eck` table, but the entity_types are re-created after following the procedure described in #1.

I can not confirm that this problem does not occur during the "behat" tests, because I do not know how to tests those.
It would be nice, if you could confirm, that those are working flawlessly. :)

I really hope that one is fixed now.

Thanks for the quick reaction, by the way :)

agrozyme’s picture

I write a class to do install.
The schema use feature module generated.
It will get the wraning.

eck 7.x-2.0-rc4
features 7.x-2.2

  function installEntityTypes() {
    foreach ($this->entityTypes() as $item) {
      $entity_type = new EntityType();
      $properties = empty($item['properties']) ? array() : $item['properties'];
      unset($item['properties']);

      foreach ($item as $index => $value) {
        $entity_type->{$index} = $value;
      }

      foreach ($properties as $index => $property) {
        $entity_type->addProperty($index, $property['label'], $property['type'], $property['behavior']);
      }

      $entity_type->save();
    }
  }
mariacha1’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
282 bytes

For whatever reason, the fix in https://www.drupal.org/node/1365602 doesn't seem to work for features-created entities during install when using drush. I get the warning listed above, but the attached patch fixes things for me.

agrozyme’s picture

Thank you mariacha1, it works!

  • fmizzell committed 5a6b446 on 7.x-2.x authored by mariacha1
    Issue #2289241 by mariacha1: Warning: array_keys() expects parameter 1...

  • fmizzell committed 7bf0944 on 7.x-2.x authored by mariacha1
    Issue #2289241 by mariacha1: Warning: array_keys() expects parameter 1...

  • fmizzell committed 9c42b13 on 7.x-3.x authored by mariacha1
    Issue #2289241 by mariacha1: Warning: array_keys() expects parameter 1...
fmizzell’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Fixed

@mariacha1 I committed a slightly modified version of your fix. Could you confirm that my version is fixing the issue? And thank you for the patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

grom358’s picture

In aGov distro was getting the same warning. Backport of patch to rc5 resolved the issue.

hanoii’s picture

Version: 7.x-3.x-dev » 7.x-2.x-dev
Status: Closed (fixed) » Active

I believe this is still active, I am getting it by doing the following:

- create a bare entity type and bundle
- add one field (probably not an important step)
- export this as a feature
- remove all references to recently created entity or try it on a different install
- enable feature

Getting the same warning, patch in #15 fixed it.

I also debugged a bit and drupal is calling drupal_schema_fields_sql for a table ('eck_created_bundle') which I guess does not exists therefore the warning, resetting schema cache seems to fix it.

hanoii’s picture

Status: Active » Needs review

Patch applies to rc7 cleanly.

delta’s picture

Status: Needs review » Reviewed & tested by the community

The patch resolve the issue for me, with an entity type exported via features, I didn't have the error anymore in the features install.

I have installed the rc7 on a clean install, and enabled a features with an eck entity_type exported.
before the patch i got the error,
after the patch the error is gone.

HnLn’s picture

Had the same problem in an install profile, patch in #15 fixes it.

alvar0hurtad0’s picture

+1 the patch works

eric.napier’s picture

fmizzell’s picture

Status: Reviewed & tested by the community » Closed (duplicate)