Closed (fixed)
Project:
Grammar Parser
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
24 Jan 2011 at 22:13 UTC
Updated:
15 Feb 2011 at 00:50 UTC
I ran the 6.x-2.x version of the Salesforce Suite modules through coder upgrade using only the coding style extensions.
The generated patch had the following hunk in it.
@@ -554,19 +570,19 @@ function salesforce_api_fieldmap_edit_fo
}
if ($value['type'] & SALESFORCE_FIELD_CREATEABLE
- && !($value['type'] & SALESFORCE_FIELD_UPDATEABLE)) {
+ && !($value['type'] & SALESFORCE_FIELD_UPDATEABLE)) {
$type = 'optional';
$required = ' <span class="form-required" title="' .
t('This field will only be set for new records.') . '">' . t('Create-only') . '</span>';
}
elseif (!($value['type'] & SALESFORCE_FIELD_CREATEABLE)
- && $value['type'] & SALESFORCE_FIELD_UPDATEABLE) {
+ && $value['type'] & SALESFORCE_FIELD_UPDATEABLE) {
$type = 'optional';
$required = ' <span class="form-required" title="' .
t('This field can only be set for existing records.') . '">' . t('Update-only') . '</span>';
}
- elseif (!($value['type'] & (SALESFORCE_FIELD_CREATEABLE | SALESFORCE_FIELD_UPDATEABLE))) {
- $type = 'optional';
+ elseif (!($value['type'] & SALESFORCE_FIELD_CREATEABLE | SALESFORCE_FIELD_UPDATEABLE) {
+ $type 'optional';
$required = ' <span class="form-required" title="' .
t('This field will be available for imports only.') . '">' . t('Read-only') . '</span>';
}
Note the third set of substitutions. It changed the logic from:
(!($a & ($b | $c)))
to:
(!($a & $b | $c)
Three things wrong:
1. Final logic is wrong.
2. Missing a closing round bracket at the end of the elseif line.
3. The second line is changed to $type 'optional'; from $type = 'optional'; which is also incorrect syntax.
Comments
Comment #1
solotandem commentedApparently, this is the first piece of code encountered with these nested bitwise expressions. Thanks for reporting this.
Comment #2
solotandem commentedFixed in next dev release.
Thanks for reporting this.
Comment #3
brianV commentedThanks for the quick fix on this!