mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Ensure the class has a constructor
if there is no constructor (this means a model which does not inherit from Model) newInstance will throw an exception. Conflicts: lib/Cake/Utility/ClassRegistry.php
This commit is contained in:
parent
0be71a08d6
commit
b8598c5ca0
1 changed files with 5 additions and 1 deletions
|
@ -158,7 +158,11 @@ class ClassRegistry {
|
|||
}
|
||||
}
|
||||
}
|
||||
$instance = $reflection->newInstance($settings);
|
||||
if ($reflection->getConstructor()) {
|
||||
$instance = $reflection->newInstance($settings);
|
||||
} else {
|
||||
$instance = $reflection->newInstance();
|
||||
}
|
||||
if ($strict) {
|
||||
$instance = ($instance instanceof Model) ? $instance : null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue