Menu

#2 Bug in jsrt::expr_lte

v1.0_(example)
open
nobody
None
5
2007-12-12
2007-12-12
No

The following code looks suspicious:

static function expr_lte($a, $b) {
$v = jsrt::cmp($b, $a);
if ($v == jsrt::$true or $v == jsrt::$undefined) return jsrt::$false;
return $v;
}

If $v is TRUE then expr_lte returns FALSE. On the other hand, when $v is FALSE it returns $v that is FALSE. Looks like this function returns FALSE in any case.

Discussion

  • philipp

    philipp - 2011-12-14

    The following patch for jsrt.php (v1.1, 2005-07-07) corrected the less-than-or-equal operator for me (see 11.8.3 of ECMA-262 3rd edition):

    631c631
    < return $v;
    ---
    > return jsrt::$true;

     
  • philipp

    philipp - 2011-12-14

    And the following patch for jsrt.php (v1.1, 2005-07-07) corrected the greater-than-or-equal operator for me (see 11.8.4 of ECMA-262 3rd edition):

    636c636
    < return $v;
    ---
    > return jsrt::$true;

     

Log in to post a comment.

MongoDB Logo MongoDB