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

WordPress cmsRootPath can incorrectly return unrelated CMS install

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Since the function cmsRootPath() starts at the bottom of the path when CIVICRM_CMSDIR is not defined (which in 4.4.6 is not even mentioned in civicrm.settings.php ), the function can inadvertendly turn up an unrelated WordPress.

      On my hosting environment, I have a main domain and any additional domains that I add are in a subdirectories under that domain's public_html, like this:

      /home/user/public_html/ <<-- maindomain.com
      /home/user/public_html/subdomain1.com/ <<-- subdomain1.com
      /home/user/public_html/subdomain2.com/ <<-- subdomain2.com

      When this script is used from a script like Cron.php, the bootstrap is called and looks for the WordPress install. In my situation, this function found the first WordPress in its search path (/home/user/public_html/) and called it good. However, CiviCRM is really installed in one of the subdomains, so user authentication failed.

      I would suggest that the function start at its own location and work down looking for a WordPress install instead of starting at the root and working up.

      Forum discussion here: http://forum.civicrm.org/index.php/topic,33500.0.html
      cmsRootPath in github: https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/System/WordPress.php#L521

      This is my first bug report with CiviCRM. Hope that all the necessary info is provided.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              eliot Eliot Landrum
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 hours
                2h
                Remaining:
                Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified