Skip to content

Loading…

DBAL-446: Type json_array can't be null #1643

Open
doctrinebot opened this Issue · 10 comments

2 participants

@doctrinebot

Jira issue originally created by user hrubi:

Column type json_array can be set to nullable, but if there's null in the database, it is returned as an empty array to PHP.

Null should be returned instead, as that's how the other types behave too.

@doctrinebot

Comment created by @beberlei:

This was fixed in 2.3.3

@doctrinebot

Comment created by wildlyinaccurate:

I'm seeing this behaviour again in v2.5.0-BETA3 (6d0b048). If I get time this week I can perform a bisect to figure out when it regressed.

@doctrinebot

Comment created by wildlyinaccurate:

Actually I don't think this was a regression; it looks like a fix was never made. I've opened a PR: #655

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-655] was closed:
#655

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-655] was assigned:
#655

@doctrinebot

Comment created by @ocramius:

Re-opened, as this behavior seems reproducible also in 2.4.x

@doctrinebot

Comment created by @deeky666:

It was never fixed. That seems to have been a misunderstanding here. As pointed out by [~ocramius] changing this behaviour is a BC break and can't be fixed before 3.0.

@doctrinebot

Comment created by frickenate:

I spent the time to develop a custom data type to workaround this bug: https://frickenate.com/2014/10/json-data-type-doctrine/ . I can't imagine anybody storing null expecting to receive back an empty array. That would be a fundamental break from the very purpose of the SQL NULL value.

@doctrinebot

Comment created by frickenate:

Any status on this for 3.0 or earlier? It is extremely sad that serialization between SQL and PHP is not consistent.

@doctrinebot doctrinebot added the Bug label
@Ocramius Ocramius was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.3.3 milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.