[Form] Form::isPostMaxSizeReached() only triggers for root forms

This commit is contained in:
Bernhard Schussek 2011-01-28 23:13:10 +01:00
parent 4fcb98547c
commit 7680657944
2 changed files with 21 additions and 1 deletions

View File

@ -241,6 +241,16 @@ class Field extends Configurable implements FieldInterface
return $this->parent;
}
/**
* Returns whether the field has a parent.
*
* @return Boolean
*/
public function hasParent()
{
return null !== $this->parent;
}
/**
* Returns the root of the form tree
*
@ -251,6 +261,16 @@ class Field extends Configurable implements FieldInterface
return $this->parent ? $this->parent->getRoot() : $this;
}
/**
* Returns whether the field is the root of the form tree
*
* @return Boolean
*/
public function isRoot()
{
return !$this->hasParent();
}
/**
* Updates the field with default data
*

View File

@ -235,7 +235,7 @@ class Form extends FieldGroup
*/
public function isPostMaxSizeReached()
{
if (isset($_SERVER['CONTENT_LENGTH'])) {
if ($this->isRoot() && isset($_SERVER['CONTENT_LENGTH'])) {
$length = (int) $_SERVER['CONTENT_LENGTH'];
$max = trim(ini_get('post_max_size'));