Incorrect use of quotes and escape and ts in CRM_Core_DAO::copyValues
There's a couple things wrong with this logging line:
Civi::log()->warning(ts('A string for field $dbName has been truncated. The original string was %1', [CRM_Utils_Type::escape($value, 'String')]));
- I'm not sure it should be ts'd since it's a system-y string usually not seen by end users.
- It uses a variable inside the ts.
- The variable gets output as the literal
$dbName
instead of the value because the string uses single quotes. - CRM_Utils_Type::escape is sometimes a misleading function name. It doesn't "make the string safe in all circumstances". In this situation it escapes it for insertion into an SQL string which might be what happens if that's the log implementation being used, but isn't necessarily where it ends up. Even if database was the end target, the log implementation should escape it at insertion time, not here.