BUGFIX: Don't let $dataObject->ClassName be set to an improper value.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78678 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-06-09 03:29:24 +00:00
parent fb470bc53d
commit bdeda543c9

View File

@ -319,7 +319,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* @param string $className The new ClassName attribute (a subclass of {@link DataObject}) * @param string $className The new ClassName attribute (a subclass of {@link DataObject})
*/ */
function setClassName($className) { function setClassName($className) {
$this->class = trim($className); $className = trim($className);
if(!$className || !is_subclass_of($className, 'DataObject')) return;
$this->class = $className;
$this->setField("ClassName", $className); $this->setField("ClassName", $className);
} }