1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 00:37:02 +02:00
This commit is contained in:
Ryan Cramer
2022-05-17 11:25:04 -04:00
parent 924f932145
commit a0adc207de

View File

@@ -2115,8 +2115,15 @@ class PageFinder extends Wire {
// non-presence of row is equal to value being blank
$bindKey = $query->bindValueGetKey($blankValue);
if($ft->isEmptyValue($field, $value)) {
// matching an empty value: null or literal empty value
$sql = "$tableAlias.$col IS NULL OR ($tableAlias.$col=$bindKey";
if($value === '' && !$ft->isEmptyValue($field, '0') && $field->get('zeroNotEmpty')) {
// MySQL blank string will also match zero (0) in some cases, so we prevent that here
// @todo remove the 'zeroNotEmpty' condition for test on dev as it limits to specific fieldtypes is likely unnecessary
$sql .= " AND $tableAlias.$col!='0'";
}
} else {
// matching a non-empty value
$sql = "($tableAlias.$col=$bindKey";
}
/*