Skip to content

Xyster_Data_Expression breaks 0 (zero) #1

Description

@doublecompile

First of all: thank you for building Xyster!

Problem case:

$origvalue = 0;
$e = new Xyster_Data_Expression('field', '=', $origvalue);
$value = $e->getRight();
if ($value != $origvalue) die("The expression value changed!\n");

The problem lies within the __constructor() method of Xyster_Data_Expression:

        if ( $value == "NULL" ) {
            $value = null;
        }

That should be at least $value === "NULL" to prevent a zero from being translated into NULL. Arguably, this kind of check should not be in this constructor at all, since this case would break too:

// I checked and on my website I *do* have a user that goes by this name ;-)
$e = new Xyster_Data_Expression('name', '=', 'NULL');

If this is in here for support in XSQL, I suggest to fully remove the check and let the decision to search for a NULL value to the XSQL parsing process.
Reporter: Maurice Makaay
Begin: 2009-08-24
Completed: 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions