From 34b1144ca679007e9e1842228a8b04fd74e748df Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 22 Apr 2016 20:55:38 -0700 Subject: [PATCH] CRM-17983, CRM-18401 - Swap loose/strict escaping The old names suggested that loose checking (`MysqlColumnName`) should be the norm, and strict checking (`MysqlColumnNameStrict`) the exception. Rather, strict should be the norm. This also has a functional affect switching the new `defaultSortAndPagerParams()` to use strict behavior. --- CRM/Utils/Rule.php | 4 ++-- CRM/Utils/Type.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CRM/Utils/Rule.php b/CRM/Utils/Rule.php index 8a3058222b..439a095be0 100644 --- a/CRM/Utils/Rule.php +++ b/CRM/Utils/Rule.php @@ -94,7 +94,7 @@ class CRM_Utils_Rule { * * @return bool */ - public static function mysqlColumnName($str) { + public static function mysqlColumnNameLoose($str) { // check the length. // This check can be incorrect for the . format, which can be // a problem. @@ -112,7 +112,7 @@ class CRM_Utils_Rule { * * @return bool */ - public static function mysqlColumnNameStrict($str) { + public static function mysqlColumnName($str) { // Check the length. if (empty($str) || strlen($str) > 64) { return FALSE; diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index 0ce72074a6..6b423818b0 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -258,20 +258,20 @@ class CRM_Utils_Type { } break; - case 'MysqlColumnName': - if (CRM_Utils_Rule::MysqlColumnName($data)) { + case 'MysqlColumnNameLoose': + if (CRM_Utils_Rule::mysqlColumnNameLoose($data)) { return str_replace('`', '', $data); } break; - case 'MysqlColumnNameStrict': - if (CRM_Utils_Rule::MysqlColumnNameStrict($data)) { + case 'MysqlColumnName': + if (CRM_Utils_Rule::mysqlColumnName($data)) { return $data; } break; case 'MysqlOrderByDirection': - if (CRM_Utils_Rule::MysqlOrderByDirection($data)) { + if (CRM_Utils_Rule::mysqlOrderByDirection($data)) { return $data; } break; -- 2.25.1