I'm a subscriber to Acquia network service and I tried to set up this module on my website. I enabled acquia_agent and acquia_spi modules and updated the settings with my subscriber info. Then I used the drush cron command and got the following error:

Fatal error: Cannot redeclare security_review_run()

It turns out that acquia_spi module contains a file security_review.inc which has apparently been copy and pasted from Security Review module. It contains a bunch of the same exact function declarations and therefore creates a bunch of namespace conflicts.

I'm filing this issue as a bug report, but it's apparently very intentional. The whole file is one big namespace conflict, it can't just be an accident. I re-read the instructions for this module thinking maybe there was a warning about not installing both modules at the same time, but I don't see any directions like that. And the issue is not just that they shouldn't both be enabled at the same time, but apparently they both can't be installed in the codebase together, even when turned off.

To make matters more difficult, these two modules do not have the same exact functionality. Acquia Network Connector has some overlap with Security Review, but they also have differences, which makes it even more problematic that they can't both be installed simultaneously. I would like to take advantage of my Acquia subscription, but I also would like to use Security Review module, and apparently I can't do both.

Can someone please explain what's going on here?

Thanks,
Eric

CommentFileSizeAuthor
#14 acquia-connector-1427982.patch61.01 KBcoltrane

Comments

ericbroder’s picture

Title: Critical namespace conflicts with Security Review module » Many namespace conflicts with Security Review module
Priority: Critical » Major

Changing priority to major since this doesn't affect users who do not have Security Review module installed.

coltrane’s picture

Status: Active » Postponed (maintainer needs more info)

What version of the Security Review module are you using?

coltrane’s picture

You can use both together, just need to be running 6.x-1.2

ericbroder’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Thanks for the feedback. I now suspect that there is something wrong with my sandbox, since I am getting many different php errors, and can't consistently replicate the issue I reported here. See: http://drupal.org/node/1208618#comment-5583498

ericbroder’s picture

Status: Closed (cannot reproduce) » Active

Apparently the problem is not just my sandbox because this error suddenly reappeared for the first time in weeks on our production server. We have Security Review 6.x-1.2 and Acquia 6.x-2.1.

I don't know how to replicate it consistently. Sometimes I get this error:

PHP Fatal error:  Cannot redeclare security_review_run() (previously declared in /drupalroot/sites/all/modules/acquia_connector/acquia_spi/security_review.inc:19) in /drupalroot/sites/all/modules/sec
urity_review/security_review.inc on line 41

From reading the code, the error makes sense to me because it does appear to be redeclaring an existing function. I don't know why it's not consistent and why no one else seems to be reporting this problem. I'm using PHP 5.2.13 on our production server.

coltrane’s picture

@ericbroder 2.2 of Acquia Connector will be out in the next couple weeks. I'll work on a more explicit check for it so this doesn't happen.

ericbroder’s picture

Thanks coltrane, I'll keep an eye out for it.

I'm also curious, why is it that this module doesn't follow the namespace convention? I'm just as confused as anyone why this error is so inconsistent, but the general naming convention seems pretty clear to me:

Functions should in addition have the grouping/module name as a prefix, to avoid name collisions between modules.

ref: http://drupal.org/coding-standards#naming

coltrane’s picture

Status: Active » Fixed

Should be fixed in 2.2

Status: Fixed » Closed (fixed)

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

waynejon’s picture

Version: 6.x-2.x-dev » 6.x-2.4
Status: Closed (fixed) » Needs work

Reporting experiencing this issue with an update to 6.x-2.4.

Summary: a recent update of the Acquia Connector module from previous version to release 6.x-2.4 has created incompatibilities with the Security Review module. See below:

Fatal error: Cannot redeclare security_review_run() (previously declared in /docroot/sites/all/modules/contrib/acquia_connector/acquia_spi/security_review.inc:19) in /docroot/sites/all/modules/contrib/security_review/security_review.inc on line 41
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Cannot redeclare security_review_run() (previously declared in
/docroot/sites/all/modules/contrib/acquia_connector/acquia_spi/security_review.inc:19)
/docroot/sites/all/modules/contrib/security_review/security_review.inc, line 41
WD cron: Cron run exceeded the time limit and was aborted.

Following related enabled modules with conflicts:
Acquia Network Connector Acquia agent (acquia_agent) Module Enabled 6.x-2.4
Acquia Network Connector Acquia Site Profile Information (acquia_spi) Module Enabled 6.x-2.4
Other Security Review (security_review) Module Enabled 6.x-1.2

FunkMonkey’s picture

I can verify the same behavior as waynejon after an update to 2.4. Cron will not run.

coltrane’s picture

Status: Needs work » Postponed (maintainer needs more info)

I can't replicate this so I suspect there's something specific to your environment and installation that causes this. Can you list enabled modules and details of your environment such as os and php version? How is cron being called?

FunkMonkey’s picture

In my case it was just a matter of disabling Security Review module and fully removing the files from /sites/all/modules to get cron working again correctly. I have no idea why the 'cannot redeclare security_review_run()' would prevent cron from finishing.

Would fixing the problem be as simple as changing that function name to something different? acquia_security_review_run() or something like that?

I was calling cron manually with 'drush cron'. Running OpenSuse 12 and php 5.3.8.. Let me know if you still want a modules list. It definitely seems to be Security Review though.

Thanks.

coltrane’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new61.01 KB

Try this patch out while having the Security Review module enabled. It applies to Acquia Connector 6.x-2.x

coltrane’s picture

Status: Fixed » Closed (fixed)

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