Doctrine 1
  1. Doctrine 1
  2. DC-299

Doctrine::loadModels() returns an incorrect result if there is some models named before "Base"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0-RC1
    • Fix Version/s: 1.2.0
    • Component/s: None
    • Labels:
      None

      Description

      If there is a model named before "Base" (in the alpabetical order), like "Address", Doctrine::loadModels() returns an incorrect array by including the BaseAddress class :

      Array
      (
          [Address] => Address
          [BaseAddress] => BaseAddress
      )
      

      This happens because in the list of files, Address.class.php (where Address extends BaseAddress) comes before BaseAddress.class.php. So BaseAddress is already loaded when loadModels() checks if the BaseAddress class exists. Then this class is added in the loaded models without check if this is a valid model class.

      This can be easily fixed :

      // Doctrine/Core.php , line 679:
      
      // replace :
      
      $loadedModels[$className] = $className;
      
      // by :
      if (self::isValidModelClass($className)) {
        $loadedModels[$className] = $className;
      }
      

        Activity

        Hide
        Jonathan H. Wage added a comment -

        Thanks for the ticket and fix.

        Show
        Jonathan H. Wage added a comment - Thanks for the ticket and fix.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Colin Darie
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: