-
-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
"array" type: Not working for arrays of DateTime objects #199
Comments
This seems like a bug. A tested fix would be appreciated. |
When you work on a fix, can you make sure that you do not break support for:
|
I tried running the test suite and got errors, e.g.:
What's wrong? |
@lukey78 Your PHPUnit version is too old. Use PHPUnit 3.7 (i.e. the current stable version) |
@stof: Thanks! I tried fixing this issue and stumbled upon the following behaviour where I'm not sure if it's wrong what I'm doing or if the Serializer doesn't handle this correctly. Given an object with the following annotated property:
Serialized to XML with some example data I get:
When trying to deserialize this XML back into the object I get an empty array:
Maybe I used the wrong XML annotations? |
I think XmlKeyValuePairs is a one way street currently. You can remove the deserialization part of this test case. |
fix issue #199: "array" type ignoring DateTime format
I recently tried to use the following annotation that should work as documented:
But it doesn't. The DateTimes are serialized to empty strings.
While investigating the problem I found that line in the
visitArray
function of (e.g.) theGenericSerializationVisitor
:$type['params'][1]
normally doesn't exist. Theaccept
function is called with a null type which results in auto detection of the type.If I change the
$type['params'][1]
to$type['params'][0]
everything seems to work as expected.Is this a bug or a feature? I could also submit a pull request if this is a bug.
Thanks,
Jens
The text was updated successfully, but these errors were encountered: