Bug #52068

ArrayConverter should accept empty strings

Added by Christian Eßl about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Property
Target version:
-
Start date:
2013-09-17
Due date:
% Done:

0%

PHP Version:
Has patch:
Yes
Complexity:

Description

Imagine a select-box like this:

<label for="categories">Categories:</label> 
<select name="content[categories][]" multiple="TRUE" id="categories">
  <option value="0">Category 1</option>
  <option value="1">Category 2</option>
  <option value="2">Category 3</option>
</select>

with this array-property:

/**
 * @var array 
 */ 
protected $categories;

The select box allows multiple selected categories and none is selected by default.

If you submit the form without selecting any category, the PropertyMapper throws the exception:

No converter found which can be used to convert from" "string" to "array".

The property mapper treats the empty values of the categories-select as string.
Shouldn't in this case the ArrayConverter accept empty strings and convert them to an empty array()?


Related issues

Duplicates TYPO3 Flow Base Distribution - Task #48148: Allow PropertyMapping of strings to arrays Resolved 2013-05-13

History

#1 Updated by Adrian Föder about 6 years ago

  • Category set to Property
  • Status changed from New to Closed
  • Has patch changed from No to Yes

Also available in: Atom PDF