diff --git a/src/Symfony/Component/Form/Field.php b/src/Symfony/Component/Form/Field.php index 0354cde55c..33aeba0e5c 100644 --- a/src/Symfony/Component/Form/Field.php +++ b/src/Symfony/Component/Form/Field.php @@ -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 * diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 6c16b7fab7..0e18a7f495 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -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'));