mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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
This commit is contained in:
parent
f4a04788f3
commit
ccefe02de9
1 changed files with 4 additions and 2 deletions
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue