BUGFIX: addFieldToTab segfaulting under PHP 5.2

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@105264 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Mark Stephens 2010-05-20 06:04:30 +00:00 committed by Sam Minnee
parent 56be2afbc5
commit ca873121fa

View File

@ -335,7 +335,8 @@ class FieldSet extends DataObjectSet {
$i = 0;
foreach($this->items as $child) {
if($name == $child->Name() || $name == $child->id) {
array_splice($this->items, $i, 0, array($item));
// On PHP 5.2.6, using $this->items directly in array_splice can segfault
$itms = $this->items; array_splice($itms, $i, 0, array($item));
return $item;
} elseif($child->isComposite()) {
$ret = $child->insertBefore($item, $name);