When you disable the devel module it will attempt to restore the smtp library setting by copying the value of the devel_old_smtp_library variable into the smtp_library variable.
However the devel_old_smtp_library variable is only set when you visit the devel module's settings page. If you disable the module without ever visiting the settings page it will just blank your current smtp_library value since devel_old_smtp_library doesn't exist.
Either devel_old_smtp_library should be set when you enable the module or the disable should be a bit more discerning about what it actually changes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dmitriy.trt’s picture

Version: 6.x-1.x-dev » 6.x-1.26
Priority: Normal » Major
Status: Active » Needs review
FileSize
1.02 KB

Setting major priority, because this bug could completely break email sending for a whole site, like it was in our case.

Patch was made from stable 6.x-1.26 version, it fixes problem.

salvis’s picture

Status: Needs review » Needs work

Thank you for the patch.

+++ mod/devel.install	2011-09-01 18:07:11.000000000 +0700
@@ -94,9 +94,19 @@
+  $old_smtp = variable_get('devel_old_smtp_library', '');
+  $current_smtp = variable_get('smtp_library', '');

Please use NULL instead of '' and...

+++ mod/devel.install	2011-09-01 18:07:11.000000000 +0700
@@ -94,9 +94,19 @@
+  if ($current_smtp == drupal_get_filename('module', 'devel') || $current_smtp == '') {

... empty() rather than =='' and swap the conditions.

+++ mod/devel.install	2011-09-01 18:07:11.000000000 +0700
@@ -94,9 +94,19 @@
+    if ($old_smtp != '') {
+      variable_set('smtp_library', $old_smtp);
+    }
+    else {
+      variable_del('smtp_library');
+    }

Again empty() and swap.

This is to encourage clean and efficient coding.

Dmitriy.trt’s picture

Status: Needs work » Needs review
FileSize
1.02 KB

Made all changes, here is a new version.

salvis’s picture

Status: Needs review » Needs work

Much better. empty() and isset() are very fast, much faster than comparisons.

+++ mod/devel.install	2011-09-16 10:39:58.000000000 +0700
@@ -94,9 +94,19 @@
+    variable_del('devel_old_smtp_library');

Should this go outside the braces?

Dmitriy.trt’s picture

Status: Needs work » Needs review
FileSize
961 bytes

Yes, you're right.

salvis’s picture

Status: Needs review » Fixed

Committed to D6 -dev. Not applicable to the other versions.

Thanks!

Status: Fixed » Closed (fixed)

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