Details
- 
    Type:Bug 
- 
    Status: Done/Fixed
- 
    Priority:Trivial 
- 
    Resolution: Fixed/Completed
- 
    Affects Version/s: 4.4.5
- 
    Fix Version/s: 4.4.6
- 
    Component/s: None
- 
    Labels:None
- 
        Sprint:Sprint CT1
Description
I have been able to replicate this in a test (have also hit it 'in the wild') - the test kind of explains the scenario - I have set against 4.4.6 due to catastrophic effects when it occurs - but will have to investigate the fix to determine if there is a simple or complex fix
    // this call is our control - at time of writing this test passed & the one with the bad hook failed
    $membership = CRM_Member_BAO_Membership::create($params, $ids);
    $this->callAPISuccessGetSingle('membership', array('id' => $membership->id));
    $this->callAPISuccess('membership', 'delete', array('id' => $membership->id));
    $this->hookClass = CRM_Utils_Hook::singleton();
    $this->hookClass->setHook('civicrm_post', array($this, 'badPostFunction'));
    //if there is a rollback this second call will not create a membership
    $membership = CRM_Member_BAO_Membership::create($params, $ids);
    $this->callAPISuccessGetSingle('membership', array('id' => $membership->id));