Commit 0a761995 authored by Jo Hasenau's avatar Jo Hasenau Committed by Markus Klein
Browse files

[TASK] Replace all strcmp() calls with ===

This patch replaces about 300 places using strcmp()
in the whole core. There are different contexts for strcmp()
within this set, i.e. checking for strings being '0',
'', not '' and the like.

strcmp() has to stay when it comes to real sorting of strings,
which is a rather rare case, otherwise it can be replaced with
faster alternatives.

The following 'rules' were used for the replacement:

* Use a type cast if you can't be sure about the incoming values.
  We do not need type casts if the types are implicitly defined
  before by another function. i.e. intval(), trim(), substr()
* Use int-cast whenever the values to be compared are numbers only.
* Use string-cast for any other combination. i.e
  (string)$len === '0' when $len can be NULL, which is different
  to (int)$len === 0

Resolves: #54085
Releases: 6.2
Change-Id: I88fb294ae20d8c23ff58d8296fbb37925d5213c8
Reviewed-on: https://review.typo3.org/25843
Reviewed-by: Markus Klein
Tested-by: Markus Klein
parent c9651784
......@@ -158,9 +158,8 @@ class ClickMenu {
@ini_set('display_errors', 0);
}
// Deal with Drag&Drop context menus
if (strcmp(GeneralUtility::_GP('dragDrop'), '')) {
$CMcontent = $this->printDragDropClickMenu(GeneralUtility::_GP('dragDrop'), GeneralUtility::_GP('srcId'), GeneralUtility::_GP('dstId'));
return $CMcontent;
if ((string)GeneralUtility::_GP('dragDrop') !== '') {
return $this->printDragDropClickMenu(GeneralUtility::_GP('dragDrop'), GeneralUtility::_GP('srcId'), GeneralUtility::_GP('dstId'));
}
// Can be set differently as well
$this->iParts[0] = GeneralUtility::_GP('table');
......@@ -174,7 +173,7 @@ class ClickMenu {
if ($GLOBALS['BE_USER']->uc['condensedMode'] || $this->iParts[2] == 2) {
$this->alwaysContentFrame = 1;
}
if (strcmp($this->iParts[1], '')) {
if (isset($this->iParts[1]) && $this->iParts[1] !== '') {
$this->isDBmenu = 1;
}
$TSkey = ($this->isDBmenu ? 'page' : 'folder') . ($this->listFrame ? 'List' : 'Tree');
......@@ -224,17 +223,18 @@ class ClickMenu {
* @todo Define visibility
*/
public function printDBClickMenu($table, $uid) {
$uid = intval($uid);
// Get record:
$this->rec = BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
$root = 0;
$DBmount = FALSE;
// Rootlevel
if ($table == 'pages' && !strcmp($uid, '0')) {
if ($table === 'pages' && $uid === 0) {
$root = 1;
}
// DB mount
if ($table == 'pages' && in_array($uid, $GLOBALS['BE_USER']->returnWebmounts())) {
if ($table === 'pages' && in_array($uid, $GLOBALS['BE_USER']->returnWebmounts())) {
$DBmount = TRUE;
}
// Used to hide cut,copy icons for l10n-records
......@@ -249,10 +249,10 @@ class ClickMenu {
$lCP = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $table == 'pages' ? $this->rec['uid'] : $this->rec['pid']));
// View
if (!in_array('view', $this->disabledItems)) {
if ($table == 'pages') {
if ($table === 'pages') {
$menuItems['view'] = $this->DB_view($uid);
}
if ($table == $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) {
if ($table === $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) {
$ws_rec = BackendUtility::getRecordWSOL($table, $this->rec['uid']);
$menuItems['view'] = $this->DB_view($ws_rec['pid']);
}
......@@ -290,7 +290,7 @@ class ClickMenu {
$root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen']),
$this->clipObj->currentMode()
);
if ($table == 'pages' && $lCP & 8) {
if ($table === 'pages' && $lCP & 8) {
if ($elFromAllTables) {
$menuItems['pasteinto'] = $this->DB_paste('', $uid, 'into', $elInfo);
}
......@@ -330,12 +330,13 @@ class ClickMenu {
* @todo Define visibility
*/
public function printNewDBLevel($table, $uid) {
$uid = (int)$uid;
// Setting internal record to the table/uid :
$this->rec = BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
$root = 0;
// Rootlevel
if ($table == 'pages' && !strcmp($uid, '0')) {
if ($table === 'pages' && $uid === 0) {
$root = 1;
}
// If record was found, check permissions and get menu items.
......@@ -1226,7 +1227,7 @@ class ClickMenu {
$p = 1;
reset($menuItems);
while (TRUE) {
if (!strcmp(key($menuItems), $menuEntry)) {
if ((string)key($menuItems) === $menuEntry) {
$pointer = $p;
$found = TRUE;
break;
......@@ -1310,7 +1311,7 @@ class ClickMenu {
* @todo Define visibility
*/
public function excludeIcon($iconCode) {
return $GLOBALS['BE_USER']->uc['noMenuMode'] && strcmp($GLOBALS['BE_USER']->uc['noMenuMode'], 'icons') ? '' : ' ' . $iconCode;
return $GLOBALS['BE_USER']->uc['noMenuMode'] && $GLOBALS['BE_USER']->uc['noMenuMode'] !== 'icons' ? '' : ' ' . $iconCode;
}
/**
......
......@@ -277,7 +277,7 @@ class NewContentElementController {
$code = $GLOBALS['LANG']->getLL('sel2', 1) . '<br /><br />';
// Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
$modTSconfig_SHARED = BackendUtility::getModTSconfig($this->id, 'mod.SHARED');
$colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
$colPosList = trim($modTSconfig_SHARED['properties']['colPos_list']) !== '' ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
$colPosList = implode(',', array_unique(GeneralUtility::intExplode(',', $colPosList)));
// Removing duplicates, if any
// Finally, add the content of the column selector to the content:
......@@ -365,7 +365,7 @@ class NewContentElementController {
foreach ($wizards as $groupKey => $wizardGroup) {
$groupKey = preg_replace('/\\.$/', '', $groupKey);
$showItems = GeneralUtility::trimExplode(',', $wizardGroup['show'], TRUE);
$showAll = strcmp($wizardGroup['show'], '*') ? FALSE : TRUE;
$showAll = $wizardGroup['show'] === '*';
$groupItems = array();
if (is_array($appendWizards[$groupKey . '.']['elements.'])) {
$wizardElements = array_merge((array) $wizardGroup['elements.'], $appendWizards[$groupKey . '.']['elements.']);
......
......@@ -679,14 +679,14 @@ class EditDocumentController {
if ($editForm) {
$this->firstEl = reset($this->elementsData);
// Checking if the currently open document is stored in the list of "open documents" - if not, then add it:
if ((strcmp($this->docDat[1], $this->storeUrlMd5) || !isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
if (($this->docDat[1] !== $this->storeUrlMd5 || !isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
$this->docHandler[$this->storeUrlMd5] = array($this->storeTitle, $this->storeArray, $this->storeUrl, $this->firstEl);
$GLOBALS['BE_USER']->pushModuleData('alt_doc.php', array($this->docHandler, $this->storeUrlMd5));
BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
}
// Module configuration
$this->modTSconfig = $this->viewId ? BackendUtility::getModTSconfig($this->viewId, 'mod.xMOD_alt_doc') : array();
$body .= $this->tceforms->printNeededJSFunctions_top();
$body = $this->tceforms->printNeededJSFunctions_top();
$body .= $this->compileForm($editForm);
$body .= $this->tceforms->printNeededJSFunctions();
$body .= $this->functionMenus();
......@@ -1439,7 +1439,7 @@ class EditDocumentController {
* @todo Define visibility
*/
public function setDocument($currentDocFromHandlerMD5 = '', $retUrl = 'alt_doc_nodoc.php') {
if (!ExtensionManagementUtility::isLoaded('cms') && !strcmp($retUrl, 'alt_doc_nodoc.php')) {
if (!ExtensionManagementUtility::isLoaded('cms') && $retUrl === 'alt_doc_nodoc.php') {
return;
}
if (!$this->modTSconfig['properties']['disableDocSelector'] && is_array($this->docHandler) && count($this->docHandler)) {
......
......@@ -647,7 +647,7 @@ class PageLayoutController {
}
// Selecting all content elements from this language and allowed colPos:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting');
$colPos = '';
$colPos = NULL;
$first = 1;
// Page is the pid if no record to put this after.
$prev = $this->id;
......@@ -660,7 +660,7 @@ class PageLayoutController {
}
$first = 0;
}
if (strcmp($cRow['colPos'], $colPos)) {
if (!isset($colPos) || $cRow['colPos'] !== $colPos) {
$colPos = $cRow['colPos'];
$opt[] = '<option value=""></option>';
$opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $GLOBALS['LANG']->sL(BackendUtility::getLabelFromItemlist('tt_content', 'colPos', $colPos), TRUE) . ':__</option>';
......@@ -749,7 +749,7 @@ class PageLayoutController {
}
if (!$recordAccess) {
// If no edit access, print error message:
$content .= $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />' . ($GLOBALS['BE_USER']->errorMsg ? 'Reason: ' . $GLOBALS['BE_USER']->errorMsg . '<br /><br />' : ''), 0, 1);
$content = $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />' . ($GLOBALS['BE_USER']->errorMsg ? 'Reason: ' . $GLOBALS['BE_USER']->errorMsg . '<br /><br />' : ''), 0, 1);
} elseif (is_array($rec)) {
// If the record is an array (which it will always be... :-)
// Create instance of TCEforms, setting defaults:
......@@ -792,11 +792,11 @@ class PageLayoutController {
$defaultFlashMessageQueue->enqueue($flashMessage);
}
// Add whole form as a document section:
$content .= $this->doc->section('', $theCode);
$content = $this->doc->section('', $theCode);
}
} else {
// If no edit access, print error message:
$content .= $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />', 0, 1);
$content = $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />', 0, 1);
}
// Bottom controls (function menus):
$q_count = $this->getNumberOfHiddenElements();
......@@ -900,7 +900,7 @@ class PageLayoutController {
// ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
$colList = array('1', '0', '2', '3');
}
if (strcmp($this->colPosList, '')) {
if ($this->colPosList !== '') {
$colList = array_intersect(GeneralUtility::intExplode(',', $this->colPosList), $colList);
}
// If only one column found, display the single-column view.
......
......@@ -253,10 +253,8 @@ class ShortcutFrameController {
// Selection-clause for users - so users can deleted only their own shortcuts (except admins)
$addUSERWhere = !$GLOBALS['BE_USER']->isAdmin() ? ' AND userid=' . intval($GLOBALS['BE_USER']->user['uid']) : '';
// Deleting shortcuts:
if (strcmp($this->deleteCategory, '')) {
if (MathUtility::canBeInterpretedAsInteger($this->deleteCategory)) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_be_shortcuts', 'sc_group=' . intval($this->deleteCategory) . $addUSERWhere);
}
if (MathUtility::canBeInterpretedAsInteger($this->deleteCategory)) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_be_shortcuts', 'sc_group=' . intval($this->deleteCategory) . $addUSERWhere);
}
// If other changes in post-vars:
if (is_array($_POST)) {
......@@ -344,7 +342,7 @@ class ShortcutFrameController {
$bookmarkGroups = $GLOBALS['BE_USER']->getTSConfigProp('options.bookmarkGroups');
if (is_array($bookmarkGroups) && count($bookmarkGroups)) {
foreach ($bookmarkGroups as $k => $v) {
if (strcmp('', $v) && strcmp('0', $v)) {
if ((int)$v !== 0) {
$this->groupLabels[$k] = (string) $v;
} elseif ($GLOBALS['BE_USER']->isAdmin()) {
unset($this->groupLabels[$k]);
......@@ -396,9 +394,9 @@ class ShortcutFrameController {
$this->editSC_rec = $row;
}
$sc_group = $row['sc_group'];
if ($sc_group && strcmp($formerGr, $sc_group)) {
if ($sc_group && $formerGr !== $sc_group) {
if ($sc_group != -100) {
if ($this->groupLabels[abs($sc_group)] && strcmp('1', $this->groupLabels[abs($sc_group)])) {
if ($this->groupLabels[abs($sc_group)] && $this->groupLabels[abs($sc_group)] !== '1') {
$label = $this->groupLabels[abs($sc_group)];
} else {
$label = $GLOBALS['LANG']->getLL('shortcut_group_' . abs($sc_group), TRUE);
......@@ -502,6 +500,7 @@ class ShortcutFrameController {
/**
* Creates lines for the editing form.
*
*
* @return void
* @todo Define visibility
*/
......@@ -514,7 +513,7 @@ class ShortcutFrameController {
$opt = array();
$opt[] = '<option value="0"></option>';
foreach ($this->groupLabels as $k => $v) {
if ($v && strcmp('1', $v)) {
if ((int)$v > 1) {
$label = $v;
} else {
$label = $GLOBALS['LANG']->getLL('bookmark_group_' . $k, TRUE);
......@@ -523,11 +522,11 @@ class ShortcutFrameController {
$label = $GLOBALS['LANG']->getLL('bookmark_group', TRUE) . ' ' . $k;
}
}
$opt[] = '<option value="' . $k . '"' . (!strcmp($this->editSC_rec['sc_group'], $k) ? ' selected="selected"' : '') . '>' . $label . '</option>';
$opt[] = '<option value="' . $k . '"' . ((string)$this->editSC_rec['sc_group'] === (string)$k ? ' selected="selected"' : '') . '>' . $label . '</option>';
}
if ($GLOBALS['BE_USER']->isAdmin()) {
foreach ($this->groupLabels as $k => $v) {
if ($v && strcmp('1', $v)) {
if (intval($v) > 1) {
$label = $v;
} else {
$label = $GLOBALS['LANG']->getLL('bookmark_group_' . $k, TRUE);
......@@ -538,9 +537,9 @@ class ShortcutFrameController {
}
// Add a prefix for global groups
$label = $GLOBALS['LANG']->getLL('bookmark_global', TRUE) . ': ' . $label;
$opt[] = '<option value="-' . $k . '"' . (!strcmp($this->editSC_rec['sc_group'], ('-' . $k)) ? ' selected="selected"' : '') . '>' . $label . '</option>';
$opt[] = '<option value="-' . $k . '"' . ((int)$this->editSC_rec['sc_group'] === -((int)$k) ? ' selected="selected"' : '') . '>' . $label . '</option>';
}
$opt[] = '<option value="-100"' . (!strcmp($this->editSC_rec['sc_group'], '-100') ? ' selected="selected"' : '') . '>' . $GLOBALS['LANG']->getLL('bookmark_global', TRUE) . ': ' . $GLOBALS['LANG']->getLL('bookmark_all', TRUE) . '</option>';
$opt[] = '<option value="-100"' . ((int)$this->editSC_rec['sc_group'] === -100 ? ' selected="selected"' : '') . '>' . $GLOBALS['LANG']->getLL('bookmark_global', TRUE) . ': ' . $GLOBALS['LANG']->getLL('bookmark_all', TRUE) . '</option>';
}
// border="0" hspace="2" width="21" height="16" - not XHTML compliant in <input type="image" ...>
$manageForm = '
......
......@@ -115,7 +115,7 @@ class AddController {
$this->pid = intval($this->P['params']['pid']);
}
// Return if new record as parent (not possibly/allowed)
if (!strcmp($this->pid, '')) {
if ($this->pid > 0) {
HttpUtility::redirect(GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']));
}
// Else proceed:
......
......@@ -738,7 +738,7 @@ class FormsController {
if ($vv['default']) {
$thisLine[2] = 1;
}
} elseif (strcmp(trim($vv['default']), '')) {
} elseif (trim($vv['default']) !== '') {
$thisLine[2] = $vv['default'];
}
if (isset($thisLine[2])) {
......@@ -852,7 +852,7 @@ class FormsController {
*/
public function cleanT($tArr) {
for ($a = count($tArr); $a > 0; $a--) {
if (strcmp($tArr[$a - 1], '')) {
if ((string)$tArr[$a - 1] !== '') {
break;
} else {
unset($tArr[$a - 1]);
......
......@@ -93,7 +93,7 @@ class ListController {
}
// Make redirect:
// If pid is blank OR if id is set, then return...
if (!strcmp($this->pid, '') || strcmp($this->id, '')) {
if ((string)$this->id !== '') {
$redirectUrl = GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
} else {
// Otherwise, show the list:
......
......@@ -156,7 +156,7 @@ class RteController {
$rec['pid'] = $rawRec['pid'];
// TSconfig, setting width:
$fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']);
if (strcmp($fieldTSConfig['RTEfullScreenWidth'], '')) {
if ((string)$fieldTSConfig['RTEfullScreenWidth'] !== '') {
$width = $fieldTSConfig['RTEfullScreenWidth'];
} else {
$width = '100%';
......
......@@ -106,7 +106,7 @@ class DataPreprocessor {
* @todo Define visibility
*/
public function fetchRecord($table, $idList, $operation) {
if ((string) $idList == 'prev') {
if ((string)$idList == 'prev') {
$idList = $this->prevPageID;
}
if ($GLOBALS['TCA'][$table]) {
......@@ -114,7 +114,7 @@ class DataPreprocessor {
$ids = GeneralUtility::trimExplode(',', $idList, TRUE);
foreach ($ids as $id) {
// If ID is not blank:
if (strcmp($id, '')) {
if ((string)$id !== '') {
// For new records to be created, find default values:
if ($operation == 'new') {
// Default values:
......@@ -260,11 +260,11 @@ class DataPreprocessor {
foreach ($copyOfColumns as $field => $fieldConfig) {
// Set $data variable for the field, either inputted value from $row - or if not found, the default value as defined in the "config" array
if (isset($row[$field])) {
$data = (string) $row[$field];
$data = (string)$row[$field];
} elseif (array_key_exists($field, $row) && !empty($fieldConfig['config']['eval']) && GeneralUtility::inList($fieldConfig['config']['eval'], 'null')) {
$data = NULL;
} else {
$data = (string) $fieldConfig['config']['default'];
$data = (string)$fieldConfig['config']['default'];
}
$data = $this->renderRecord_SW($data, $fieldConfig, $TSconfig, $table, $row, $field);
$totalRecordContent[$field] = $data;
......@@ -297,7 +297,7 @@ class DataPreprocessor {
* @todo Define visibility
*/
public function renderRecord_SW($data, $fieldConfig, $TSconfig, $table, $row, $field) {
switch ((string) $fieldConfig['config']['type']) {
switch ((string)$fieldConfig['config']['type']) {
case 'group':
$data = $this->renderRecord_groupProc($data, $fieldConfig, $TSconfig, $table, $row, $field);
break;
......@@ -395,7 +395,7 @@ class DataPreprocessor {
$fieldConfig['config']['items'] = $this->procesItemArray($fieldConfig['config']['items'], $fieldConfig['config'], $TSconfig[$field], $table, $row, $field);
foreach ($fieldConfig['config']['items'] as $pvpv) {
foreach ($elements as $eKey => $value) {
if (!strcmp($value, $pvpv[1])) {
if ((string)$value === (string)$pvpv[1]) {
$dataAcc[$eKey] = rawurlencode($pvpv[1]) . '|' . rawurlencode($this->sL($pvpv[0]));
}
}
......@@ -522,7 +522,7 @@ class DataPreprocessor {
$dataAcc[] = $theId;
} else {
foreach ($elements as $eKey => $value) {
if (!strcmp($theId, $value)) {
if ((int)$theId === (int)$value) {
$dataAcc[$eKey] = $theId;
}
}
......@@ -630,12 +630,12 @@ class DataPreprocessor {
*/
public function selectAddSpecial($dataAcc, $elements, $specialKey) {
// Special select types:
switch ((string) $specialKey) {
switch ((string)$specialKey) {
case 'tables':
$tNames = array_keys($GLOBALS['TCA']);
foreach ($tNames as $tableName) {
foreach ($elements as $eKey => $value) {
if (!strcmp($tableName, $value)) {
if ((string)$tableName === (string)$value) {
$dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($this->sL($GLOBALS['TCA'][$value]['ctrl']['title']));
}
}
......@@ -646,7 +646,7 @@ class DataPreprocessor {
if (is_array($theTypes)) {
foreach ($theTypes as $theTypesArrays) {
foreach ($elements as $eKey => $value) {
if (!strcmp($theTypesArrays[1], $value)) {
if ((string)$theTypesArrays[1] === (string)$value) {
$dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($this->sL($theTypesArrays[0]));
}
}
......@@ -658,7 +658,7 @@ class DataPreprocessor {
if (is_array($theExcludeFields)) {
foreach ($theExcludeFields as $theExcludeFieldsArrays) {
foreach ($elements as $eKey => $value) {
if (!strcmp($theExcludeFieldsArrays[1], $value)) {
if ((string)$theExcludeFieldsArrays[1] === (string)$value) {
$dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode(rtrim($theExcludeFieldsArrays[0], ':'));
}
}
......@@ -671,7 +671,7 @@ class DataPreprocessor {
if (is_array($theTypeArrays['items'])) {
foreach ($theTypeArrays['items'] as $itemValue => $itemContent) {
foreach ($elements as $eKey => $value) {
if (!strcmp(($tableFieldKey . ':' . $itemValue . ':' . $itemContent[0]), $value)) {
if (($tableFieldKey . ':' . $itemValue . ':' . $itemContent[0]) === (string)$value) {
$dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode(('[' . $itemContent[2] . '] ' . $itemContent[1]));
}
}
......@@ -683,7 +683,7 @@ class DataPreprocessor {
$theLangs = BackendUtility::getSystemLanguages();
foreach ($theLangs as $lCfg) {
foreach ($elements as $eKey => $value) {
if (!strcmp($lCfg[1], $value)) {
if ((string)$lCfg[1] === (string)$value) {
$dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($lCfg[0]);
}
}
......@@ -697,7 +697,7 @@ class DataPreprocessor {
// Traverse items:
foreach ($coValue['items'] as $itemKey => $itemCfg) {
foreach ($elements as $eKey => $value) {
if (!strcmp(($coKey . ':' . $itemKey), $value)) {
if (($coKey . ':' . $itemKey) === (string)$value) {
$dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($this->sL($itemCfg[0]));
}
}
......@@ -724,7 +724,7 @@ class DataPreprocessor {
}
// Add modules own label now:
$label .= $GLOBALS['LANG']->moduleLabels['tabs'][$value . '_tab'];
if (!strcmp($theModName, $value)) {
if ((string)$theModName === (string)$value) {
$dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($label);
}
}
......@@ -785,7 +785,7 @@ class DataPreprocessor {
$dataAcc[] = rawurlencode($theId) . '|' . rawurlencode(GeneralUtility::fixed_lgd_cs(($lPrefix . strip_tags($recordList[$theId])), $GLOBALS['BE_USER']->uc['titleLen']));
} else {
foreach ($elements as $eKey => $value) {
if (!strcmp($theId, $value)) {
if ((int)$theId === (int)$value) {
$dataAcc[$eKey] = rawurlencode($theId) . '|' . rawurlencode(GeneralUtility::fixed_lgd_cs(($lPrefix . strip_tags($recordList[$theId])), $GLOBALS['BE_USER']->uc['titleLen']));
}
}
......
......@@ -565,7 +565,7 @@ class InlineElement {
$recTitle = BackendUtility::getRecordTitle($itemParts[0], $recTemp, FALSE);
}
$recTitle = BackendUtility::getRecordTitlePrep($recTitle);
if (!strcmp(trim($recTitle), '')) {
if (trim($recTitle) === '') {
$recTitle = BackendUtility::getNoRecordTitle(TRUE);
}
} else {
......@@ -1548,7 +1548,7 @@ class InlineElement {
$removeItems = GeneralUtility::trimExplode(',', $PA['fieldTSConfig']['removeItems'], TRUE);
foreach ($selItems as $tk => $p) {
// Checking languages and authMode:
$languageDeny = $tcaTableCtrl['languageField'] && !strcmp($tcaTableCtrl['languageField'], $field) && !$GLOBALS['BE_USER']->checkLanguageAccess($p[1]);
$languageDeny = $tcaTableCtrl['languageField'] && (string)$tcaTableCtrl['languageField'] === $field && !$GLOBALS['BE_USER']->checkLanguageAccess($p[1]);
$authModeDeny = $config['form_type'] == 'select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode($table, $field, $p[1], $config['authMode']);
if (in_array($p[1], $removeItems) || $languageDeny || $authModeDeny) {
unset($selItems[$tk]);
......
......@@ -141,9 +141,9 @@ class TreeElement {
// Create a JavaScript code line which will ask the user to save/update the form due to changing the element.
// This is used for eg. "type" fields and others configured with "requestUpdate"
if (
$GLOBALS['TCA'][$table]['ctrl']['type']
&& !strcmp($field, $GLOBALS['TCA'][$table]['ctrl']['type'])
|| $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']
!empty($GLOBALS['TCA'][$table]['ctrl']['type'])
&& $field === $GLOBALS['TCA'][$table]['ctrl']['type']
|| !empty($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'])
&& GeneralUtility::inList(str_replace(' ', '', $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']), $field)
) {
if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
......
......@@ -674,7 +674,7 @@ class FormEngine {
foreach ($fields as $fieldInfo) {
$parts = explode(';', $fieldInfo);
$theField = trim($parts[0]);
if (!in_array($theField, $excludeElements) && !strcmp($theField, $theFieldToReturn)) {
if (!in_array($theField, $excludeElements) && (string)$theField === (string)$theFieldToReturn) {
if ($GLOBALS['TCA'][$table]['columns'][$theField]) {
$sField = $this->getSingleField($table, $theField, $row, $parts[1], 1, $parts[3], $parts[2]);
return $sField['ITEM'];
......@@ -762,16 +762,16 @@ class FormEngine {
$parts = explode(';', $fieldInfo);
// Getting the style information out:
$color_style_parts = GeneralUtility::trimExplode('-', $parts[4]);
if (strcmp($color_style_parts[0], '')) {
if ($color_style_parts[0] !== '') {
$this->setColorScheme($GLOBALS['TBE_STYLES']['colorschemes'][intval($color_style_parts[0])]);
}
if (strcmp($color_style_parts[1], '')) {
if ($color_style_parts[1] !== '') {
$this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][intval($color_style_parts[1])];
if (!isset($this->fieldStyle)) {
$this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0];
}
}
if (strcmp($color_style_parts[2], '')) {
if ($color_style_parts[2] !== '') {
$this->wrapBorder($out_array[$out_sheet], $out_pointer);
$this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][intval($color_style_parts[2])];
if (!isset($this->borderStyle)) {
......@@ -1036,7 +1036,7 @@ class FormEngine {
&& $PA['fieldConf']['config']['form_type'] != 'passthrough'
&& ($this->RTEenabled || !$PA['fieldConf']['config']['showIfRTE'])
&& $displayConditionResult
&& (!$GLOBALS['TCA'][$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || strcmp($PA['fieldConf']['l10n_mode'], 'exclude') || $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] <= 0)
&& (!$GLOBALS['TCA'][$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || ($PA['fieldConf']['l10n_mode'] !== 'exclude') || $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] <= 0)
&& (!$GLOBALS['TCA'][$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode === $PA['fieldConf']['l10n_cat'])
) {
// Fetching the TSconfig for the current table/field. This includes the $row which means that
......@@ -1067,9 +1067,9 @@ class FormEngine {
}
// Create a JavaScript code line which will ask the user to save/update the form due to changing the element. This is used for eg. "type" fields and others configured with "requestUpdate"
if (
$GLOBALS['TCA'][$table]['ctrl']['type']
&& !strcmp($field, $typeField)
|| $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']
!empty($GLOBALS['TCA'][$table]['ctrl']['type'])
&& $field === $typeField
|| !empty($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'])
&& GeneralUtility::inList(str_replace(' ', '', $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']), $field)
) {
if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
......@@ -1715,7 +1715,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
$p = $selItems[$c];
$rID = $PA['itemFormElID'] . '_' . $c;
$rOnClick = implode('', $PA['fieldChangeFunc']);
$rChecked = !strcmp($p[1], $PA['itemFormElValue']) ? ' checked="checked"' : '';
$rChecked = (string)$p[1] === (string)$PA['itemFormElValue'] ? ' checked="checked"' : '';
$item .= '<input type="radio"' . $this->insertDefStyle('radio') . ' name="' . $PA['itemFormElName'] . '" value="' . htmlspecialchars($p[1]) . '" onclick="' . htmlspecialchars($rOnClick) . '"' . $rChecked . $PA['onFocus'] . $disabled . ' id="' . $rID . '" />
<label for="' . $rID . '">' . htmlspecialchars($p[0]) . '</label>
<br />';
......@@ -1752,13 +1752,13 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
// If a SINGLE selector box...
if ($maxitems <= 1 && $config['renderMode'] !== 'tree') {
$item = $this->getSingleField_typeSelect_single($table, $field, $row, $PA, $config, $selItems, $nMV_label);
} elseif (!strcmp($config['renderMode'], 'checkbox')) {
} elseif ($config['renderMode'] === 'checkbox') {
// Checkbox renderMode
$item = $this->getSingleField_typeSelect_checkbox($table, $field, $row, $PA, $config, $selItems, $nMV_label);
} elseif (!strcmp($config['renderMode'], 'singlebox')) {
} elseif ($config['renderMode'] === 'singlebox') {