DDC-3863: Wrong return if value is null in JsonArrayType #4731

Closed
opened 2026-01-22 14:48:29 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 3, 2015).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user talus:

On the JsonArray type, on the conversion from a database value to a php value, if the value is null or empty, it returns an empty array.

The thing is, I have a inherited field (or more specifically two fields with the same name, which is not in the parent entity (as another subentity doesn't need such a field).

Basically, it tries to load the field which appears two times (for a field name called field, it has two columns in the data array : field*1 and field_2). The value for a entity has one of these null, respectively the field_1 for the first subentity, and field*2 for the second subentity.

The JsonArrayType then recognizes the field named field in the data, and returns an empty array if the value is null... Then doctrine stores in into cache, but when it comes to the second field (field_2), as it sees he has a cache for field, it ignores the value as the value is not null.

So basically, the problems lies within the JsonArrayType, which should return null if the value is null ? But I'm not quite sure if this is BC...

I was not sure if this belonged to the orm or the dbal.

Originally created by @doctrinebot on GitHub (Aug 3, 2015). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user talus: On the JsonArray type, on the conversion from a database value to a php value, if the value is null or empty, it returns an empty array. The thing is, I have a inherited field (or more specifically two fields with the same name, which is not in the parent entity (as another subentity doesn't need such a field). Basically, it tries to load the field which appears two times (for a field name called `field`, it has two columns in the `data` array : `field*1` and `field_2`). The value for a entity has one of these null, respectively the `field_1` for the first subentity, and `field*2` for the second subentity. The JsonArrayType then recognizes the field named `field` in the data, and returns an empty array if the value is null... Then doctrine stores in into cache, but when it comes to the second field (`field_2`), as it sees he has a cache for `field`, it ignores the value as the value is not null. So basically, the problems lies within the JsonArrayType, which should return null if the value is null ? But I'm not quite sure if this is BC... I was not sure if this belonged to the orm or the dbal.
admin added the Bug label 2026-01-22 14:48:29 +01:00
admin closed this issue 2026-01-22 14:48:29 +01:00
Author
Owner

@doctrinebot commented on GitHub (Aug 3, 2015):

Comment created by talus:

Implementation for master's branch

@doctrinebot commented on GitHub (Aug 3, 2015): Comment created by talus: Implementation for master's branch
Author
Owner

@glen-84 commented on GitHub (Jan 19, 2022):

@beberlei I think this should be closed? (https://github.com/doctrine/dbal/pull/892)

@glen-84 commented on GitHub (Jan 19, 2022): @beberlei I think this should be closed? (https://github.com/doctrine/dbal/pull/892)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4731