From ade7a187f94b7d6ee1e19bfe1ceac718a5273cd2 Mon Sep 17 00:00:00 2001 From: Steffen Kamper Date: Sun, 13 Mar 2011 14:09:57 +0100 Subject: [PATCH] [BUGFIX] Missing initialization of variables Initialize variables, which are used, but not initialized in every case before. Change-Id: Icc2193cccf3f309edf76f69c90deaeb5e300e828 Resolves: #M17934 Reviewed-on: http://review.typo3.org/1235 Reviewed-by: Steffen Kamper Tested-by: Steffen Kamper --- t3lib/class.t3lib_admin.php | 1 + t3lib/class.t3lib_befunc.php | 2 +- t3lib/class.t3lib_fullsearch.php | 6 +++-- t3lib/class.t3lib_positionmap.php | 5 +++-- t3lib/class.t3lib_querygenerator.php | 7 ++++-- t3lib/class.t3lib_superadmin.php | 2 ++ t3lib/class.t3lib_tceforms.php | 32 ++++++++++++++++++--------- t3lib/class.t3lib_tceforms_inline.php | 13 +++++++++-- t3lib/class.t3lib_timetrack.php | 2 +- 9 files changed, 50 insertions(+), 20 deletions(-) diff --git a/t3lib/class.t3lib_admin.php b/t3lib/class.t3lib_admin.php index 8fdd380388d3..0eb7f645d2a4 100644 --- a/t3lib/class.t3lib_admin.php +++ b/t3lib/class.t3lib_admin.php @@ -674,6 +674,7 @@ class t3lib_admin { */ function testDBRefs($theArray) { global $TCA; + $result = ''; foreach ($theArray as $table => $dbArr) { if ($TCA[$table]) { $idlist = array_keys($dbArr); diff --git a/t3lib/class.t3lib_befunc.php b/t3lib/class.t3lib_befunc.php index 757ee1f0d82d..1b5c58b1fcd1 100644 --- a/t3lib/class.t3lib_befunc.php +++ b/t3lib/class.t3lib_befunc.php @@ -2424,7 +2424,7 @@ final class t3lib_BEfunc { // If this field is a password field, then hide the password by changing it to a random number of asterisk (*) if (stristr($theColConf['eval'], 'password')) { - unset($l); + $l = ''; $randomNumber = rand(5, 12); for ($i = 0; $i < $randomNumber; $i++) { $l .= '*'; diff --git a/t3lib/class.t3lib_fullsearch.php b/t3lib/class.t3lib_fullsearch.php index 4755aa90c152..66bbf95c3105 100644 --- a/t3lib/class.t3lib_fullsearch.php +++ b/t3lib/class.t3lib_fullsearch.php @@ -361,6 +361,7 @@ class t3lib_fullsearch { function queryMaker() { global $TCA; + $output = ''; if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3lib_fullsearch'])) { $this->hookArray = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3lib_fullsearch']; } @@ -412,7 +413,7 @@ class t3lib_fullsearch { $res = @$GLOBALS['TYPO3_DB']->sql_query($qExplain); if ($GLOBALS['TYPO3_DB']->sql_error()) { - $out .= '
Error:
' . $GLOBALS['TYPO3_DB']->sql_error() . ''; + $out = '
Error:
' . $GLOBALS['TYPO3_DB']->sql_error() . ''; $output .= $GLOBALS['SOBE']->doc->section('SQL error', $out, 0, 1); } else { $cPR = $this->getQueryResultCode($mQ, $res, $qGen->table); @@ -434,7 +435,7 @@ class t3lib_fullsearch { */ function getQueryResultCode($mQ, $res, $table) { global $TCA; - $output = ''; + $out = ''; $cPR = array(); switch ($mQ) { case 'count': @@ -586,6 +587,7 @@ class t3lib_fullsearch { $SET = $GLOBALS['SOBE']->MOD_SETTINGS; $swords = $SET['sword']; + $out = ''; $limit = 200; $showAlways = 0; if ($swords) { diff --git a/t3lib/class.t3lib_positionmap.php b/t3lib/class.t3lib_positionmap.php index c3b7225ce20f..2c544daed8d8 100644 --- a/t3lib/class.t3lib_positionmap.php +++ b/t3lib/class.t3lib_positionmap.php @@ -120,6 +120,7 @@ class t3lib_positionMap { function positionTree($id, $pageinfo, $perms_clause, $R_URI) { global $LANG, $BE_USER; + $code = ''; // Make page tree object: $t3lib_pageTree = t3lib_div::makeInstance('localPageTree'); $t3lib_pageTree->init(' AND ' . $perms_clause); @@ -234,7 +235,7 @@ class t3lib_positionMap { * @return string @@ -1532,8 +1535,8 @@ class t3lib_queryGenerator { TBE_EDITOR.backend_interface = "' . $GLOBALS['BE_USER']->uc['interfaceSetup'] . '"; ' . $this->extJSCODE . ' '; - return $out; } + return $out; } /** diff --git a/t3lib/class.t3lib_superadmin.php b/t3lib/class.t3lib_superadmin.php index bbf0cc8a32b0..b2a96c57a83e 100644 --- a/t3lib/class.t3lib_superadmin.php +++ b/t3lib/class.t3lib_superadmin.php @@ -480,6 +480,7 @@ class t3lib_superadmin { * @see initProcess() */ function processSiteDir($path, $dir) { + $out = ''; if (@is_dir($path)) { $localconf = $path . '/typo3conf/localconf.php'; if (@is_file($localconf)) { @@ -1307,6 +1308,7 @@ class t3lib_superadmin { $pass = trim(t3lib_div::_POST('NEWPASS')); $passMD5 = t3lib_div::_POST('NEWPASS_md5'); + $content = ''; $updatedFlag = 0; if (($pass || $passMD5) && is_array($whichFields)) { $pass = $passMD5 ? $passMD5 : md5($pass); diff --git a/t3lib/class.t3lib_tceforms.php b/t3lib/class.t3lib_tceforms.php index 9930e1610d74..da7dec23b742 100644 --- a/t3lib/class.t3lib_tceforms.php +++ b/t3lib/class.t3lib_tceforms.php @@ -1051,6 +1051,7 @@ class t3lib_TCEforms { $classAndStyleAttributes = $this->formWidthAsArray($size); $fieldAppendix = ''; + $item = ''; $cssClasses = array($classAndStyleAttributes['class']); $cssStyle = $classAndStyleAttributes['style']; @@ -1384,6 +1385,7 @@ class t3lib_TCEforms { function getSingleField_typeCheck($table, $field, $row, &$PA) { $config = $PA['fieldConf']['config']; + $item = ''; $disabled = ''; if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; @@ -1460,6 +1462,7 @@ class t3lib_TCEforms { function getSingleField_typeRadio($table, $field, $row, &$PA) { $config = $PA['fieldConf']['config']; + $item = ''; $disabled = ''; if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; @@ -1614,7 +1617,10 @@ class t3lib_TCEforms { $size = intval($config['size']); $selectedStyle = ''; // Style set on '; - $out = $item; + $item = ''; } - return $out; + return $item; } /** @@ -5444,6 +5455,7 @@ class t3lib_TCEforms { function JSbottom($formname = 'forms[0]', $update = FALSE) { $jsFile = array(); $elements = array(); + $out = ''; // required: foreach ($this->requiredFields as $itemImgName => $itemName) { diff --git a/t3lib/class.t3lib_tceforms_inline.php b/t3lib/class.t3lib_tceforms_inline.php index 88d35251d0a5..9e4471752c34 100644 --- a/t3lib/class.t3lib_tceforms_inline.php +++ b/t3lib/class.t3lib_tceforms_inline.php @@ -176,6 +176,8 @@ class t3lib_TCEforms_inline { return FALSE; } + $item = ''; + // count the number of processed inline elements $this->inlineCount++; @@ -1345,6 +1347,7 @@ class t3lib_TCEforms_inline { * @return array An array to be used for JSON */ protected function getExecuteChangesJsonArray($oldItemList, $newItemList) { + $data = ''; $parent = $this->getStructureLevel(-1); $current = $this->inlineStructure['unstable']; @@ -2105,11 +2108,15 @@ class t3lib_TCEforms_inline { * @return string The wrapped HTML code */ function wrapFormsSection($section, $styleAttrs = array(), $tableAttrs = array()) { + $style = ''; + $table = ''; if (!$styleAttrs['margin-right']) { $styleAttrs['margin-right'] = $this->inlineStyles['margin-right'] . 'px'; } - foreach ($styleAttrs as $key => $value) $style .= ($style ? ' ' : '') . $key . ': ' . htmlspecialchars($value) . '; '; + foreach ($styleAttrs as $key => $value) { + $style .= ($style ? ' ' : '') . $key . ': ' . htmlspecialchars($value) . '; '; + } if ($style) { $style = ' style="' . $style . '"'; } @@ -2133,7 +2140,9 @@ class t3lib_TCEforms_inline { $tableAttrs['class'] = $this->borderStyle[3]; } - foreach ($tableAttrs as $key => $value) $table .= ($table ? ' ' : '') . $key . '="' . htmlspecialchars($value) . '"'; + foreach ($tableAttrs as $key => $value) { + $table .= ($table ? ' ' : '') . $key . '="' . htmlspecialchars($value) . '"'; + } $out = '' . $section . '
'; return $out; diff --git a/t3lib/class.t3lib_timetrack.php b/t3lib/class.t3lib_timetrack.php index 845153a23ed6..72799ed7c245 100644 --- a/t3lib/class.t3lib_timetrack.php +++ b/t3lib/class.t3lib_timetrack.php @@ -392,7 +392,7 @@ class t3lib_timeTrack { // key value: $keyValue = $data['value']; - $item .= '' . $this->fw(htmlspecialchars($keyValue)) . ''; + $item .= '' . $this->fw(htmlspecialchars($keyValue)) . ''; if ($this->printConf['allTime']) { $item .= ' ' . $this->fw($data['starttime']) . ''; -- 2.20.1