Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XMLType on nullable columns return true instead of null #21

Open
HansPeterOrding opened this issue Feb 1, 2021 · 0 comments
Open

XMLType on nullable columns return true instead of null #21

HansPeterOrding opened this issue Feb 1, 2021 · 0 comments

Comments

@HansPeterOrding
Copy link

HansPeterOrding commented Feb 1, 2021

The method convertToPHPValue of class XMLType returns boolean true if nullable column equals null. The use of short comparison operator is causing this issue.
Solution:

This block:

public function convertToPHPValue($value, AbstractPlatform $platform)
{
    return $value === null ?: new \SimpleXMLElement($value);
}

Should be replaced by this:

public function convertToPHPValue($value, AbstractPlatform $platform)
{
    return $value === null ? null : new \SimpleXMLElement($value);
}

Or for PHP versions >= 7:

public function convertToPHPValue($value, AbstractPlatform $platform)
{
    return $value === null ?? new \SimpleXMLElement($value);
}

See [PR-22]](#22) for PHP version > 5 fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant