Skip to content

Commit

Permalink
fix NULL comparison, #40
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkez committed Feb 28, 2017
1 parent 0582270 commit e303fdc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/db/cortex.php
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,9 @@ public function prepareFilter($cond, $engine, $db, $fieldConf=null) {
$bindMarks = str_repeat('?,', count($val) - 1).'?';
$part = substr($part, 0, $pos).'IN ('.$bindMarks.')';
$ncond = array_merge($ncond, $val);
} elseif($val === null && preg_match('/(\w+)\s*([!=<>]+)\s*\?/i',$part,$match)) {
$part = $match[1].' IS '.($match[2]=='='||$match[2]=='=='?'':'NOT ').'NULL';
} elseif($val === null &&
preg_match('/(\S[\w\-]+\S)\s*(!?==?)\s*(?:\?|:\w+)/i',$part,$match)) {
$part = $match[1].' IS '.($match[2][0]=='!'?'NOT ':'').'NULL';
} else
$ncond[] = $val;
}
Expand Down

0 comments on commit e303fdc

Please sign in to comment.