Skip to content

Json_Array: Convert database null to PHP null instead of empty array #538

Closed
wants to merge 2 commits into from

4 participants

@doctrinebot

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DBAL-828

We use Jira to track the state of pull requests and the versions they got
included in.

@Ocramius
Doctrine member
Ocramius commented Mar 4, 2014

@localheinz saw this - waiting for @deeky666's opinion first.

@deeky666 deeky666 commented on the diff Mar 4, 2014
lib/Doctrine/DBAL/Types/JsonArrayType.php
@@ -55,7 +55,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null) {
- return array();
+ return null;
@deeky666
Doctrine member
deeky666 added a note Mar 4, 2014

Not sure if we can change this in 2.x as it surely breaks BC. @beberlei thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@deeky666
Doctrine member

To preserve BC we cannot change that in 2.x unfortunately but instead have to address this in 3.0 as @guilhermeblanco pointed out in doctrine/doctrine2#968.
Closing this for now and keeping the issue open on JIRA marking it for 3.0

@deeky666 deeky666 closed this Apr 24, 2014
@localheinz localheinz deleted the localheinz:bugfix/nullable-json-array-mapped-to-empty-array branch Apr 24, 2014
@deeky666 deeky666 added Bug Improvement and removed Bug labels Jan 5, 2016
@deeky666 deeky666 self-assigned this Jan 5, 2016
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.