頁(yè)面?zhèn)鬟fin、like等非Null/NOT NULL查詢時(shí),如果參數(shù)值為空時(shí),Crud.php中的selectInput(Request $request)未能將空值參數(shù)過(guò)濾掉。
例如http://..../select?area[0]=like&area[1]=cat_id[0]=in&cat_id[1]=
整
將Crud.php中selectInput函數(shù)中:
foreach ($where as $column => $value) {
if (
$value === '' || !isset($allow_column[$column]) ||
is_array($value) && (empty($value) || !in_array($value[0], ['null', 'not null']) && !empty($value[1]))
) {
unset($where[$column]);
}
}
修改成:
foreach ($where as $column => $value) {
if (
$value === '' || !isset($allow_column[$column]) ||
is_array($value) && (empty($value) || !in_array($value[0], ['null', 'not null']) && empty($value[1]))
) {
unset($where[$column]);
}
}
可以將該問(wèn)題解決,目前暫時(shí)未發(fā)現(xiàn)造成的其他影響,不知道會(huì)不會(huì)有后續(xù)影響?