Skip to content

Commit d534013

Browse files
committed
Fixed suspicious binary operations errors
1 parent 7fd7f03 commit d534013

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Version 1.5.x -
22
----------------------------
33
- Bug: fixed error on setup module with db transaction
4+
- Bug: fixed error in usage of simplexml_load_file
45

56

67
Version 1.4.1 - 30 Jan, 2021

framework/helpers/CHtml.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ public static function checkBoxList($name, $select, $data, $htmlOptions = [])
568568
$checkAll = true;
569569

570570
foreach ($data as $value => $label) {
571-
$checked = !is_array($select) && !strcmp($value, $select) || is_array($select) && in_array($value, $select);
571+
$checked = (!is_array($select) && !strcmp($value, $select)) || (is_array($select) && in_array($value, $select));
572572
$checkAll = $checkAll && $checked;
573573
$htmlOptions['value'] = $value;
574574
$htmlOptions['id'] = $baseID . '_' . $id++;
@@ -775,7 +775,7 @@ public static function listOptions($selection, $listData, &$htmlOptions)
775775
// For single-level arrays where additional options available
776776
$attributes = ['value' => (string)$key, 'encode' => ! $raw];
777777
if (!empty($value['optionDisabled'])) $attributes['disabled'] = true;
778-
if (!is_array($selection) && !strcmp($key, $selection) || is_array($selection) && in_array($key, $selection)) {
778+
if ((!is_array($selection) && !strcmp($key, $selection)) || (is_array($selection) && in_array($key, $selection))) {
779779
$attributes['selected'] = 'selected';
780780
}
781781
if (isset($options[$key])) $attributes = array_merge($attributes, $options[$key]);
@@ -790,7 +790,7 @@ public static function listOptions($selection, $listData, &$htmlOptions)
790790
}
791791
} else {
792792
$attributes = ['value' => (string)$key, 'encode' => ! $raw];
793-
if (!is_array($selection) && !strcmp($key, $selection) || is_array($selection) && in_array($key, $selection)) {
793+
if ((!is_array($selection) && !strcmp($key, $selection)) || (is_array($selection) && in_array($key, $selection))) {
794794
$attributes['selected'] = 'selected';
795795
}
796796
if (isset($options[$key])) $attributes = array_merge($attributes, $options[$key]);

framework/helpers/widgets/CFormValidation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ private static function _handleField($field, $fieldInfo, $isMultiArray = false,
266266
}
267267
}
268268
}
269-
} elseif ($required && (!is_array($fieldValue) && trim($fieldValue) === '' || is_array($fieldValue) && empty($fieldValue))) {
269+
} elseif ($required && ((!is_array($fieldValue) && trim($fieldValue) === '') || (is_array($fieldValue) && empty($fieldValue)))) {
270270
$valid = false;
271271
$errorMessage = A::t($msgSource, 'The field {title} cannot be empty! Please re-enter.', array('{title}' => $title));
272-
} elseif ($type == 'confirm') {
272+
} elseif ($type === 'confirm') {
273273
$confirmField = self::keyAt('validation.confirmField', $fieldInfo, '');
274274
$confirmFieldValue = $cRequest->getPost($confirmField);
275275
$confirmFieldName = self::keyAt($confirmField . '.title', $fields, '');

utils/tests/inc/validator/test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
$content .= '</td>
3333
<td class="align-center">'.($expectedValue ? '<span class="true">true</span>' : '<span class="false">false</span>').'</td>
3434
<td class="align-center">'.($result ? '<span class="true">true</span>' : '<span class="false">false</span>').'</td>
35-
<td>'.($result && $expectedValue || !$result && !$expectedValue ? '&nbsp;<span class="ok">OK</span>' : '&nbsp;<span class="failed">Failed</span>').'</td>';
35+
<td>'.(($result && $expectedValue) || (!$result && !$expectedValue) ? '&nbsp;<span class="ok">OK</span>' : '&nbsp;<span class="failed">Failed</span>').'</td>';
3636
}
3737
$content .= '</tr>';
3838
$content .= '</table>';

0 commit comments

Comments
 (0)