Skip to content

Commit

Permalink
Stricter validation for checkIfFieldExists
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Jul 30, 2018
1 parent eed7e80 commit 5e282b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CRM/Core/BAO/SchemaHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ public static function checkIfIndexExists($tableName, $indexName) {
* @return bool
*/
public static function checkIfFieldExists($tableName, $columnName, $i18nRewrite = TRUE) {
$query = "SHOW COLUMNS FROM $tableName LIKE %1";
$dao = CRM_Core_DAO::executeQuery($query, [1 => [$columnName, 'String']], TRUE, NULL, FALSE, $i18nRewrite);
$query = "SHOW COLUMNS FROM $tableName LIKE '%1'";
$dao = CRM_Core_DAO::executeQuery($query, [1 => [$columnName, 'Alphanumeric']], TRUE, NULL, FALSE, $i18nRewrite);
$result = $dao->fetch() ? TRUE : FALSE;
$dao->free();
return $result;
Expand Down

0 comments on commit 5e282b3

Please sign in to comment.