diff --git a/Form/DataTransformer/PhoneNumberToArrayTransformer.php b/Form/DataTransformer/PhoneNumberToArrayTransformer.php index 89d2b0a3..81b2cc7b 100644 --- a/Form/DataTransformer/PhoneNumberToArrayTransformer.php +++ b/Form/DataTransformer/PhoneNumberToArrayTransformer.php @@ -74,7 +74,7 @@ public function reverseTransform($value) throw new TransformationFailedException('Expected an array.'); } - if ('' === trim(implode('', $value))) { + if ('' === trim($value['number'])) { return null; } diff --git a/Tests/Form/DataTransformer/PhoneNumberToArrayTransformerTest.php b/Tests/Form/DataTransformer/PhoneNumberToArrayTransformerTest.php index 905b00b9..90d1681a 100644 --- a/Tests/Form/DataTransformer/PhoneNumberToArrayTransformerTest.php +++ b/Tests/Form/DataTransformer/PhoneNumberToArrayTransformerTest.php @@ -153,6 +153,11 @@ public function reverseTransformProvider() array('country' => '', 'number' => ''), null, ), + array( + array('GB'), + array('country' => 'GB', 'number' => ''), + null, + ), array( array('GB'), array('country' => '', 'number' => 'foo'),