From ccefe02de9d4cc462cdfc8a74158862d347afbac Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 13 Nov 2011 16:13:12 -0500 Subject: [PATCH] Fix issue with duplicate class inclusions. When trying to load a class that shared a prefix with an existing class on case insensitive file systems duplicate class errors could occur. This would happen primarily with models and missing model classes. Fixes #2223 --- lib/Cake/Core/App.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 7fce20ffc..a9d034fee 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -523,12 +523,14 @@ class App { } } - //To help apps migrate to 2.0 old style file names are allowed + // To help apps migrate to 2.0 old style file names are allowed + // if the trailing segment is one of the types that changed, alternates will be tried. foreach ($paths as $path) { $underscored = Inflector::underscore($className); $tries = array($path . $underscored . '.php'); $parts = explode('_', $underscored); - if (count($parts) > 1) { + $numParts = count($parts); + if ($numParts > 1 && in_array($parts[$numParts - 1], array('behavior', 'helper', 'component'))) { array_pop($parts); $tries[] = $path . implode('_', $parts) . '.php'; }