[TASK] Strict string value handling in system extension form
authorOliver Hader <oliver@typo3.org>
Tue, 20 Sep 2011 10:56:04 +0000 (12:56 +0200)
committerOliver Hader <oliver@typo3.org>
Tue, 20 Sep 2011 11:54:56 +0000 (13:54 +0200)
Misconfigurations in e.g. TypoScript lead to cased "Array" strings.

Change-Id: I3e161b855d7628d2b2bfc10df9dab3e9ef1d5356
Resolves: #30086
Releases: 4.6
Reviewed-on: http://review.typo3.org/5109
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/form/Classes/Domain/Model/Attributes/Abstract.php
typo3/sysext/form/Classes/Domain/Model/Element/Abstract.php

index acfcf40..de30412 100644 (file)
@@ -60,18 +60,22 @@ abstract class tx_form_Domain_Model_Attributes_Abstract {
         */
        public function __construct($value, $elementId) {
                $this->localCobj = t3lib_div::makeInstance('tslib_cObj');
-               $this->value = $value;
+               $this->setValue($value);
                $this->elementId = (integer) $elementId;
        }
 
        /**
         * Set the value
         *
-        * @param $value string The value to set
+        * @param string $valueThe value to set
         * @return void
         */
        public function setValue($value) {
-               $this->value = (string) $value;
+               if (is_string($value) === FALSE) {
+                       $value = '';
+               }
+
+               $this->value = $value;
        }
 
        /**
index b1174bf..5b0b19d 100644 (file)
@@ -183,8 +183,12 @@ abstract class tx_form_Domain_Model_Element_Abstract {
         * @return void
         */
        public function setName($name = '') {
-               if ($name != '') {
-                       $this->name = (string) $name;
+               if (is_string($name) === FALSE) {
+                       $name = '';
+               }
+
+               if ($name !== '') {
+                       $this->name = $name;
                } else {
                        $this->name = 'id-' . $this->getElementId();
                }