After updating Products.CMFCore we had issues on sites where URLTool was registered as ISiteRoot.
In the case of ERP5, we don't really need portal_url.getPortalObject(), this changes to use ERP5Site.getPortalObject(), while at the same time doing something so that portal_url.getPortalObject() also works.
See https://github.com/zopefoundation/Products.CMFCore/pull/126 for more details