Skip to content

Commit

Permalink
Merge pull request ezsystems#1094 from joaoinacio/EZP-23499_no_dataty…
Browse files Browse the repository at this point in the history
…pe_remove

Fix EZP-23499: Fatal error removing class with unexistant datatype.
  • Loading branch information
João Inácio committed Oct 30, 2014
2 parents e05dc3e + cc73a1c commit 26bee38
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion kernel/classes/ezcontentclass.php
Expand Up @@ -812,7 +812,17 @@ function removableInformation( $includeAll = true )
foreach ( $this->fetchAttributes() as $attribute )
{
$dataType = $attribute->dataType();
if ( !$dataType->isClassAttributeRemovable( $attribute ) )

if ( $dataType === null )
{
eZDebug::writeError(
"Skipping removal of class attribute for non-existent datatype " . $attribute->DataTypeString,
__METHOD__
);
continue;
}

if ( $dataType->isClassAttributeRemovable( $attribute ) )
{
$info = $dataType->classAttributeRemovableInformation( $attribute, $includeAll );
$result['list'][] = $info;
Expand Down Expand Up @@ -857,6 +867,14 @@ function removeAttributes( $removeAttributes = false, $version = false )
foreach ( $classAttributes as $classAttribute )
{
$dataType = $classAttribute->dataType();
if ( $dataType === null )
{
eZDebug::writeError(
"Skipping removal of class attribute for non-existent datatype " . $classAttribute->DataTypeString,
__METHOD__
);
continue;
}
$dataType->deleteStoredClassAttribute( $classAttribute, $version );
}
eZPersistentObject::removeObject( eZContentClassAttribute::definition(),
Expand Down

0 comments on commit 26bee38

Please sign in to comment.