mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT: Added better error message if defaults are a bad format.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79382 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5affa62e6c
commit
546a5b2c89
@ -800,6 +800,12 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
foreach($classes as $class) {
|
||||
$defaults = Object::get_static($class, 'defaults');
|
||||
|
||||
if($defaults && !is_array($defaults)) {
|
||||
user_error("Bad '$this->class' defaults given: " . var_export($defaults, true),
|
||||
E_USER_WARNING);
|
||||
$defaults = null;
|
||||
}
|
||||
|
||||
if($defaults) foreach($defaults as $fieldName => $fieldValue) {
|
||||
// SRM 2007-03-06: Stricter check
|
||||
if(!isset($this->$fieldName) || $this->$fieldName === null) {
|
||||
|
Loading…
Reference in New Issue
Block a user