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

Xyster_Data_Expression breaks 0 (zero) #1

Open
doublecompile opened this issue Apr 30, 2015 · 0 comments
Open

Xyster_Data_Expression breaks 0 (zero) #1

doublecompile opened this issue Apr 30, 2015 · 0 comments

Comments

@doublecompile
Copy link
Member

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

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

No branches or pull requests

1 participant