Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-10665

'Page not found' error message when upgrading due to bug in drupal/civicrm.module

    Details

      Description

      When upgrading from 4.1.3 to 4.1.5 I have experienced a 'Page not found error' on some of my websites. I traced the issue to the civicrm_initialize function in the civicrm.module in the drupal directory. Checking through the coding, I identified a possible logic error in the following IF statement:

      if ((!isset($args[1]) OR $args[1] != 'upgrade') &&
      (method_exists('CRM_Core_BAO_Preferences', 'value') && CRM_Core_BAO_Preferences::value('editor_id') == 4)

      (method_exists('CRM_Core_BAO_Setting', 'getItem') && CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
      // drupal wysiwyg
      'editor_id'
      ) == 4)
      ) {

      It would appear that the statement block belonging to this IF statement should not be executed if one is doing an upgrade. However, the || operator divides the conditions into two parts. Only the first part involves testing whether an upgrade is being done. The second part may well return the value TRUE even though an upgrade is being done, and consequently the statement block will be executed.

      What is required is that conditions following the the first occurrence of the && operator be enclosed in parenthesis. This will ensure that the statement block will not be executed when an upgrade is being done.

      I would also suggest that the OR operator be changed to ||. Mixing the two forms of these logical operators can create a logical headache because of their different levels of precedence.

      All of these changes have been made in v4.2 but have yet to be made in v4.1.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              maxscott Max Scott
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: