From 537e8cb507f322a9416b361f9f5f1e827670b61f 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 917e228ab6..08cbcc4a0b 100644 --- a/CRM/Utils/Rule.php +++ b/CRM/Utils/Rule.php @@ -92,7 +92,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. @@ -110,7 +110,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 fca08b7e5d..25bf54ff21 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -256,20 +256,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