$civicrm_root with relative paths causes core extensions to fail to be found
Overview
For some instances of CiviCRM, like with Drupal 8, CiviCRM is outside the web root. In that case, depending on how the $civicrm_root is generated/set, it can be set to something like "/var/www/sitename.org/web/../vendor/civicrm/civicrm-core". After a change made in https://github.com/civicrm/civicrm-core/commit/ba89bdbde1aa7f21badab003b89b2cb0052fd175, paths like this cause CiviCRM to fail to locate core extensions which causes a fatal error.
Reproduction steps
- Change the $civicrm_root to a path that contains a '..'.
- Attempt to load CiviCRM.
- Get an error "CRM_Extension_Exception_MissingException: Unknown extension: org.civicrm.shoreditch in CRM_Extension_Container_Collection->getContainer() (line 150 of /var/www/sitename.org/vendor/civicrm/civicrm-core/CRM/Extension/Container/Collection.php).".
Expected behaviour
CiviCRM should either handle paths with '..' gracefully or add validation/documentation that prevents $civicrm_root from being set to a path with invalid parts. For now, we're wrapping our $civicrm_root in realpath() to resolve the reference to '..'.