-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
public static function mysql_escape($fieldValue)
{
if (is_array($fieldValue)) {
return array_map(__METHOD__, $fieldValue);
}
if (is_bool($fieldValue)) {
return (int)$fieldValue;
}
if (self::is_json($fieldValue)) {
return self::safeJson($fieldValue);
}
if (!empty($fieldValue) && is_string($fieldValue)) {
return str_replace(
['\\', "\0", "\n", "\r", "'", '"', "\x1a"],
['\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'],
$fieldValue
);
}
return $fieldValue;
}replace
public static function mysql_escape($fieldValue)
{
if (is_array($fieldValue)) {
return array_map(__METHOD__, $fieldValue);
}
if (is_bool($fieldValue)) {
return (int)$fieldValue;
}
if (self::is_json($fieldValue)) {
fieldValue = self::safeJson($fieldValue);
}
if (!empty($fieldValue) && is_string($fieldValue)) {
return str_replace(
['\\', "\0", "\n", "\r", "'", '"', "\x1a"],
['\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'],
$fieldValue
);
}
return $fieldValue;
}note: The Json field may contain special characters of mysql, which should be handled again, not just the string type
christophmayrhofer, satezmedia, omar-fci, plibleblo, esyon and 1 more
Metadata
Metadata
Assignees
Labels
No labels