From b8598c5ca03f6cadc2076d0dba543b37e3cfefc5 Mon Sep 17 00:00:00 2001 From: AD7six Date: Mon, 9 Jan 2012 23:38:32 +0100 Subject: [PATCH] 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 --- lib/Cake/Utility/ClassRegistry.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Utility/ClassRegistry.php b/lib/Cake/Utility/ClassRegistry.php index 0dab3d442..77abb316e 100644 --- a/lib/Cake/Utility/ClassRegistry.php +++ b/lib/Cake/Utility/ClassRegistry.php @@ -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; }