Ticket #10600: class_autoload.patch

File class_autoload.patch, 1.9 KB (added by karog <mythtv@…>, 8 years ago)
  • includes/class_autoload.php

    commit f1f068e72d32c6df8c5d8f045b31611d632763f7
    Author: karog
    Date:   Fri Jun 1 17:31:26 2012 -0400
    
        modified:   class_autoload.php
        Moved search of include_path down since on OS X it prematurely found
        case indpendent matching files.
    
    diff --git a/includes/class_autoload.php b/includes/class_autoload.php
    index 8ae760c..36b70d9 100644
    a b  
    1414    function autoload($className) {
    1515        global $Path;
    1616        $className = str_replace('_', '/', $className);
    17         if (file_exists("classes/$className.php")) {
     17        if (file_exists("classes/$className.php"))
    1818            include_once "classes/$className.php";
    19             return true;
    20         }
    21         foreach (explode(PATH_SEPARATOR, ini_get('include_path')) as $path) {
    22             if (!file_exists("$path/$className.php"))
    23                 continue;
    24             include_once "$path/$className.php";
    25             return true;
    26         }
    27         if (file_exists(modules_path.'/'.module."/classes/$className.php"))
     19        elseif (file_exists(modules_path.'/'.module."/classes/$className.php"))
    2820            include_once modules_path.'/'.module."/classes/$className.php";
    2921        elseif (file_exists(modules_path.'/'.$Path[1]."/classes/$className.php"))
    3022            include_once modules_path.'/'.$Path[1]."/classes/$className.php";
    3123        elseif (file_exists(modules_path.'/'.$Path[0]."/classes/$className.php"))
    3224            include_once modules_path.'/'.$Path[0]."/classes/$className.php";
    33         else
     25        else {
     26            foreach (explode(PATH_SEPARATOR, ini_get('include_path')) as $path) {
     27                if (!file_exists("$path/$className.php"))
     28                    continue;
     29                include_once "$path/$className.php";
     30                return true;
     31            }
    3432            return false;
     33        }
     34        return true;
    3535    }
    3636
    3737    spl_autoload_register('autoload');