CRM_Core_Menu - Fix warnings during local test run (dev/core#742)
authorTim Otten <totten@civicrm.org>
Sat, 18 Jan 2020 07:44:18 +0000 (23:44 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 28 Jan 2020 22:29:11 +0000 (14:29 -0800)
Before
------

In certain local OSX+D8 test environments, when running the full suite, I got a large number of warnings like this:

```
Warning: simplexml_load_file(): I/O warning : failed to load external entity "/Users/totten/bknix/build/drupal8-clean/web/vendor/civicrm/civicrm-core//CRM/Campaign/xml/Menu/Campaign.xml" in /Users/totten/bknix/build/drupal8-clean/web/vendor/civicrm/civicrm-core/CRM/Core/Menu.php on line 99
    ```

After
-----

Those warnings seem to have gone away.

The menu still seems to populate correctly.

Comments
--------

This smells a lot like dev/core#742 -- e.g.  it's the same warning and
(after adjusting for changes in line-numbering over the months) same line of
code.

CRM/Core/Menu.php

index ceb7e2a98cdf98e1a5b18f8247b46d19d9de948b..f370b8cacb6b16e642f31bb5639fa8d68f7b2add 100644 (file)
@@ -96,7 +96,7 @@ class CRM_Core_Menu {
    * @throws Exception
    */
   public static function read($name, &$menu) {
-    $xml = simplexml_load_file($name);
+    $xml = simplexml_load_string(file_get_contents($name));
     self::readXML($xml, $menu);
   }