INFRA-132 - Comment grammar cleanup
[civicrm-core.git] / CRM / Core / ClassLoader.php
index 60d4df2ac55eb5991730dbe3a01417ebffc6362e..6ba1658c12ac17bbafced776e211884d7ca30570 100644 (file)
@@ -70,7 +70,8 @@ class CRM_Core_ClassLoader {
   /**
    * Registers this instance as an autoloader.
    *
-   * @param Boolean $prepend Whether to prepend the autoloader or not
+   * @param bool $prepend
+   *   Whether to prepend the autoloader or not.
    *
    * @api
    */
@@ -80,7 +81,7 @@ class CRM_Core_ClassLoader {
     }
     $civicrm_base_path = dirname(dirname(__DIR__));
 
-    require_once dirname(dirname(__DIR__)) . '/packages/vendor/autoload.php';
+    require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php';
 
     // we do this to prevent a autoloader errors with joomla / 3rd party packages
     // use absolute path since we dont know the content of include_path as yet
@@ -95,11 +96,11 @@ class CRM_Core_ClassLoader {
     $include_paths = array(
       '.',
       $civicrm_base_path,
-      $packages_path
+      $packages_path,
     );
     $include_paths = implode(PATH_SEPARATOR, $include_paths);
     set_include_path($include_paths . PATH_SEPARATOR . get_include_path());
-    require_once "$civicrm_base_path/packages/vendor/autoload.php";
+    require_once "$civicrm_base_path/vendor/autoload.php";
   }
 
   public function initHtmlPurifier($prepend) {
@@ -161,9 +162,11 @@ class CRM_Core_ClassLoader {
       $file = strtr($class, '_', '/') . '.php';
       // There is some question about the best way to do this.
       // "require_once" is nice because it's simple and throws
-      // intelligible errors.  The down side is that autoloaders
-      // down the chain cannot try to find the file if we fail.
-      require_once ($file);
+      // intelligible errors.
+      if (FALSE != stream_resolve_include_path($file)) {
+        require_once $file;
+      }
     }
   }
+
 }