-
-
Notifications
You must be signed in to change notification settings - Fork 212
[RTM] Quote reserved words in database queries #8813
Changes from 3 commits
e33738a
5d5c2af
2eefd3f
57803a5
3b692c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,11 @@ protected function get_error() | |
*/ | ||
protected function find_in_set($strKey, $varSet, $blnIsField=false) | ||
{ | ||
if (preg_match('/^[A-Za-z0-9_$]+$/', $strKey)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check is not necessary as it is handled by |
||
{ | ||
$strKey = static::quoteIdentifier($strKey); | ||
} | ||
|
||
if ($blnIsField) | ||
{ | ||
return "FIND_IN_SET(" . $strKey . ", " . $varSet . ")"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case we should probably use |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,11 @@ protected function get_error() | |
*/ | ||
protected function find_in_set($strKey, $varSet, $blnIsField=false) | ||
{ | ||
if (preg_match('/^[A-Za-z0-9_$]+$/', $strKey)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
{ | ||
$strKey = static::quoteIdentifier($strKey); | ||
} | ||
|
||
if ($blnIsField) | ||
{ | ||
return "FIND_IN_SET(" . $strKey . ", " . $varSet . ")"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leofeyer why did you remove the
strtolower()
?This would make it no longer work for
Rows
orROWS
.