This code spits out errors on cron runs due to abuse of t().
function salesforce_api_object_to_fieldmap_fields($object) {
$fieldmap_object = array(
'label' => t($object->label),
'fields' => array()
);
There's no reason to use t() here at all as nothing is available to translate. Attached patches for 7.x-2.x and 6.x-2.x remove it.
| Comment | File | Size | Author |
|---|---|---|---|
| rmt-6.x-2.x.patch | 528 bytes | Sborsody | |
| rmt-7.x-2.x.patch | 528 bytes | Sborsody |
Comments
Comment #1
EvanDonovan commentedIf I'm understanding correctly, this is not translatable since it is a variable. Makes sense to remove the use of t() then.
Comment #2
EvanDonovan commentedComment #3
kostajh commented@Sborsody: Thanks for the patch, that makes sense. Can you let me know what errors you get on cron run?
Does $object->label need to be passed through
check_plain()?Comment #4
Sborsody commentedHi,
The error was:
This was followed by about 5 copies of:
This was appearing on a site running the 6.x-2.x-alpha2 release. I don't have the actual data that $object->label contained, unfortunately. Theoretically it is an xsd:string label sanitized by SF *shrug*. I was thinking too of a check_plain call here, but, and correct me if I'm wrong, the code in question appears to be preparing data to be stored. The check functions are supposed to be used on output/display.
Comment #5
kostajh commentedThis is committed to 6.x-2.x-dev, thanks! http://drupalcode.org/project/salesforce.git/commit/8a5b16f
Comment #6
EvanDonovan commentedCommitted on 7.x-2.x: http://drupalcode.org/project/salesforce.git/commit/74e2953