Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.13
-
Fix Version/s: 4.7.18
-
Component/s: None
-
Labels:None
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Contributed Code
-
Verified?:No
Description
This is pretty obscure but I have been hitting a code loop and / or exit when the browser is returned from paying IF there is a setting.get api call in the hook hit on return Under wordpress on a domain other then number 1 (where 2 exist).
I don't fully understand why but the issue is appearing in some deprecated code and the code logic appears to be incorrect.
```
if ($domainID != CRM_Core_Config::domainID())
```
Sets the domain if there is a mismatch. This code is marked as deprecated & related to the config_backend setting - which is now gone. More notably the reverse of this function is
CRM_Core_BAO_Domain::resetDomain();
It is this function that the code is never returning from
From recollection this logic was primarily introduced for the purposes of unit testing across multiple domains - and the code comments say
```
/**
- Change active domain (ie. to perform a temporary action) such as changing
- config for all domains
* - Switching around the global domain variable is very risky business. This
- is ONLY used as a hack to allow CRM_Core_BAO_Setting::setItems to manipulate
- the civicrm_domain.config_backend in multiple domains. When/if config_backend
- goes away, this hack should be removed.
* - @param int $domainID
- Id for domain you want to set as current.
- @deprecated
- @see http://issues.civicrm.org/jira/browse/CRM-11204
*/
```
My patch does not go the full hog on removing this - it simply ensures that resetDomain is not called if the other is not called - however, my sense is that the test coverage here is thorough enough we could fully remove it.