thinkphp安全更新

This commit is contained in:
wispx
2018-12-11 09:15:14 +08:00
parent 38835ce604
commit 70293ae6aa
15 changed files with 98 additions and 40 deletions
+12 -6
View File
@@ -656,9 +656,9 @@ class Query
$query->fetchSql(true);
}
$count = $query->aggregate('COUNT', '*');
$count = $query->aggregate('COUNT', '*', true);
} else {
$count = $this->aggregate('COUNT', $field);
$count = $this->aggregate('COUNT', $field, true);
}
return is_string($count) ? $count : (int) $count;
@@ -1008,11 +1008,13 @@ class Query
if ($tableName) {
// 添加统一的前缀
$prefix = $prefix ?: $tableName;
foreach ($field as $key => $val) {
if (is_numeric($key)) {
$val = $prefix . '.' . $val . ($alias ? ' AS ' . $alias . $val : '');
foreach ($field as $key => &$val) {
if (is_numeric($key) && $alias) {
$field[$prefix . '.' . $val] = $alias . $val;
unset($field[$key]);
} elseif (is_numeric($key)) {
$val = $prefix . '.' . $val;
}
$field[$key] = $val;
}
}
@@ -3548,6 +3550,10 @@ class Query
*/
protected function parseView(&$options)
{
if (!isset($options['map'])) {
return;
}
foreach (['AND', 'OR'] as $logic) {
if (isset($options['where'][$logic])) {
foreach ($options['where'][$logic] as $key => $val) {