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:
AD7six 2012-01-09 23:38:32 +01:00
parent 0be71a08d6
commit b8598c5ca0

View file

@ -158,7 +158,11 @@ class ClassRegistry {
}
}
}
if ($reflection->getConstructor()) {
$instance = $reflection->newInstance($settings);
} else {
$instance = $reflection->newInstance();
}
if ($strict) {
$instance = ($instance instanceof Model) ? $instance : null;
}