Merge pull request #4003 from civicrm/4.5

Merge branch 4.5 into master
Merge pull request #4005 from civicrm/4.5

Partially revert 5dac229eb87
Fix CRM-13113. Do not try to foreach() an empty array.
Merge branch 'fuzionnz-CRM-13113' into 4.5