Fix a PHP segfault

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@77051 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2009-05-18 03:48:50 +00:00 committed by Sam Minnee
parent b49886ab0c
commit 933468aa8c

View File

@ -1222,8 +1222,8 @@ class TableListField_Item extends ViewableData {
// This supports simple FieldName syntax // This supports simple FieldName syntax
if(strpos($fieldName,'.') === false) { if(strpos($fieldName,'.') === false) {
$value = ($this->item->val($fieldName)) ? $this->item->val($fieldName) : $this->item->$fieldName; $value = ($this->item->XML_val($fieldName)) ? $this->item->XML_val($fieldName) : $this->item->$fieldName;
// This support the syntax fieldName = Relation.RelatedField // This support the syntax fieldName = Relation.RelatedField
} else { } else {
$fieldNameParts = explode('.', $fieldName) ; $fieldNameParts = explode('.', $fieldName) ;
$tmpItem = $this->item; $tmpItem = $this->item;
@ -1237,6 +1237,7 @@ class TableListField_Item extends ViewableData {
} }
} }
} }
// casting // casting
if(array_key_exists($fieldName, $this->parent->fieldCasting)) { if(array_key_exists($fieldName, $this->parent->fieldCasting)) {
$value = $this->parent->getCastedValue($value, $this->parent->fieldCasting[$fieldName]); $value = $this->parent->getCastedValue($value, $this->parent->fieldCasting[$fieldName]);
@ -1257,6 +1258,7 @@ class TableListField_Item extends ViewableData {
$value = str_replace($search, $replace, $value); $value = str_replace($search, $replace, $value);
} }
} }
$fields[] = new ArrayData(array( $fields[] = new ArrayData(array(
"Name" => $fieldName, "Name" => $fieldName,
@ -1431,4 +1433,4 @@ class TableListField_ItemRequest extends RequestHandler {
return false; return false;
} }
} }
?> ?>