The recent 2.0-rc4 update of features has changed the signature of hook_features_export_options to require the feature as the first parameter, whereas entity takes the entity_type as the first parameter. The signature of entity_features_export_options should probably change to accept the feature as the first parameter, and the entity_type second.

The error occurs with v1.2 and v1.x-dev of entity.

The error arises when trying to create a feature, giving the error message "Notice: Undefined index: entity keys in __construct() (line 31 of /vagrant/src/sites/all/modules/contrib/entity/entity.features.inc)"

Comments

scottpayne’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, entity_features_export_options.patch, failed testing.

scottpayne’s picture

Status: Needs work » Needs review
StatusFileSize
new436 bytes

Fix to patch formatting.

boobaa’s picture

Status: Needs review » Reviewed & tested by the community

Ran into the same problem, and #3 solved it for me. Thanks!

jstoller’s picture

I second the motion! This worked like a charm.

dema501’s picture

#3 works for me, thanks

geerlingguy’s picture

Version: 7.x-1.2 » 7.x-1.x-dev

Ditto. RTBC +1.

RyanPrice’s picture

Just adding another +1 for patch #3. Tested and working for me.

Thanks!

alexweber’s picture

Patch works. Thanks!

rmanola’s picture

The patch also works for me.

deciphered’s picture

I'm not going to demote this from RTBC, but I wonder if it's worth giving some consideration to backwards compatibility?

Would be easy enough to wrap the function with a conditional to check what arguments it was passed and therefore determine if the first or second argument is in fact the $entity_type.

Ideally, Features should have not prepended the new argument, but it is what it is.

mpotter’s picture

This is a side-effect of this patch in Features: http://drupalcode.org/project/features.git/commit/69df8e1fe9205afa74adad... where the dependency component needs to know the feature being exported.

Technically Entity API is at fault for adding it's own arguments to a Features API function that isn't documented to have any arguments. Features isn't "pre-pending" anything. It simply went from passing zero arguments, to passing the $feature being exported.

Looks like this didn't get fully tested and vetted in #2089113: Feature itself shouldn't be listed amongst its possible dependencies which I apologize for.

Since it's possible that this could cause problems with other modules and with backwards compatibility for Entity API, I'm going to revert this commit and roll a new rc5 release of Features later today. I did not intend to break any compatibility this close to a full release of Features 2.0.

mpotter’s picture

Status: Reviewed & tested by the community » Fixed

OK, I have reverted #2089113: Feature itself shouldn't be listed amongst its possible dependencies and released Features 2.0-rc5. No need to patch Entity API.

mpotter’s picture

Status: Fixed » Active

Actually going to re-open this issue.

Entity API should start adding code now to deal with this issue in the future. It's likely that Features 2.1 will add this argument again. Technically Entity API shouldn't be passing it's own arguments here, so please add some code to detect the first or second argument as $entity_type.

deciphered’s picture

Ignore this

scottpayne’s picture

StatusFileSize
new781 bytes

Seeing as I got the ball rolling I'll add a patch for backwards compatibility. It's a really naive test but does the trick when tested against Features 2.0-rc4 and 2.0-rc5.

scottpayne’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, entity_features_export_options.patch, failed testing.

scottpayne’s picture

Status: Needs work » Needs review
StatusFileSize
new771 bytes

Hmm... helps if I patch against the clean branch, not my already patched version >_<

vegansupreme’s picture

#19 works for me!

deciphered’s picture

StatusFileSize
new1018 bytes
new673 bytes

Drupal coding standards update and possibly a couple pedantic amendments to the patch, but changed the argument names to more conform with Drupal standard when arguments may be one of many things ($a1, $a2, etc), uppercased the null, modified the comment to the correct length and removed unnecessary parenthesis.

Otherwise, the patch worked as expected.

ergophobe’s picture

Patch in #21 successfully applied and fixed the "unsupported operand" fatal error in with current dev of Entity and RC5 of Features.

Thanks!

alexweber’s picture

Confirmed that the patch works with Features 7.x-2.0

RyanPrice’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Another confirmation for patch #21 - works great.

socialnicheguru’s picture

Yes it worked for me too.

fago’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

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