Skip to content

XMLType on nullable columns return true instead of null #21

@HansPeterOrding

Description

@HansPeterOrding

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions