From: Tim Otten Date: Sat, 23 Apr 2016 03:55:38 +0000 (-0700) Subject: CRM-17983, CRM-18401 - Swap loose/strict escaping X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=537e8cb507f322a9416b361f9f5f1e827670b61f;p=civicrm-core.git 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. --- 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;