I've got a custom install profile that includes exported CER definitions. When I install a fresh copy of my site (using 'drush site-install'), install fails and I get this error:

PHP Fatal error: Cannot redeclare cer_features_export() (previously declared in /narya/www/analytical/www/sites/all/modules/contrib/features/includes/features.ctools.inc(32) : eval()'d code:1) in /narya/www/analytical/www/sites/all/modules/contrib/cer/cer.features.inc on line 26

I was experiencing this on 7.x-3.x-alpha3, then I upgraded to 7.x-3.x-dev (latest snapshot as of right now), problem is exactly the same on both these versions.

I fixed it by putting this at the top of my cer.module file:

include_once dirname(__FILE__) . '/cer.features.inc';

(it's a hack, I know, but I'm not a features / ctools / cer expert - so, whoever has a more "correct" fix, feel free to submit a patch here for it).

Obviously the cer.features.inc file isn't getting included early enough (i.e. not until after ctools_features_declare_functions() has been called). Someone please take it from here.

Comments

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new1.99 KB

Right now, CER puts its global includes at the bottom of cer.module. I see no reason why they shouldn't be moved to the top of the module. Patch attached.

EDIT: If that doesn't fix it, another possibility is that the call to module_exists() to check for Features' presence is failing during installation. If that's the case, I'll re-roll the patch to make the include unconditional.

phenaproxima’s picture

StatusFileSize
new1.38 KB

You know what, on second thought I think that moving the contents of cer.features.inc to cer.module is a better fix.

Jaza’s picture

StatusFileSize
new2.5 KB

Sorry, but that patch still didn't do it for me, got the same error on fresh site-install.

Attached is an updated patch which does the job for me:

  • Moves cer_features_export() to the top of cer.module (apparently necessary!)
  • Deletes cer.features.inc (no longer needed)
  • Removes mention of cer.features.inc in cer_features_api()

Hope that helps.

  • Commit 25921c2 on 7.x-3.x authored by Jaza, committed by phenaproxima:
    Issue #2238213 by Jaza, phenaproxima: cer.features.inc not getting...
phenaproxima’s picture

Status: Needs review » Closed (fixed)

I reached the same conclusion -- the patch I posted in #2 does most of the same stuff, although I forgot to fix cer_features_api().

I concur that cer.features.inc is pretty much unnecessary. Patch committed and pushed.

Jaza’s picture

Cool - looking better.

Thanks for the very prompt response and commit - already updated my local codebase with latest dev version, no hacks in sight!

phenaproxima’s picture

You're quite welcome - thanks for the detailed bug report and fix! When it comes to my maintainer duties, I don't mess around :)

phenaproxima’s picture

Status: Closed (fixed) » Fixed

Fixed in dev; the patch in #3 is for 7.x-3.0-alpha3.

phenaproxima’s picture

Status: Fixed » Closed (fixed)

Fixed in 7.x-3.0-alpha4.