From ca873121faa55bbd792b8e73061f8d983b8ec747 Mon Sep 17 00:00:00 2001 From: Mark Stephens Date: Thu, 20 May 2010 06:04:30 +0000 Subject: [PATCH] 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 --- forms/FieldSet.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/forms/FieldSet.php b/forms/FieldSet.php index f37d91e58..632a61aee 100755 --- a/forms/FieldSet.php +++ b/forms/FieldSet.php @@ -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);