MDL-55136 data_object: fix param handling in fetch_all_helper

This commit is contained in:
Davo Smith 2016-07-06 10:33:06 +01:00
parent ac8d6cff54
commit a106fb8178

View File

@ -213,6 +213,7 @@ abstract class data_object {
$wheresql = array();
$dbparams = array();
foreach ($params as $var=>$value) {
if (!in_array($var, $instance->required_fields) and !array_key_exists($var, $instance->optional_fields)) {
continue;
@ -221,7 +222,7 @@ abstract class data_object {
$wheresql[] = " $var IS NULL ";
} else {
$wheresql[] = " $var = ? ";
$params[] = $value;
$dbparams[] = $value;
}
}
@ -232,7 +233,7 @@ abstract class data_object {
}
global $DB;
if ($datas = $DB->get_records_select($table, $wheresql, $params)) {
if ($datas = $DB->get_records_select($table, $wheresql, $dbparams)) {
$result = array();
foreach($datas as $data) {