Skip to content

Commit 8e5356a

Browse files
committed
FIX various PHP8 exceptions
count(NULL) DS -> DIRECTORY_SEPARATOR FIX Exception FIX TaskPivotPlugin: array_filter changed behaviour with PHP8 ? LIB gettext exception https://github.com/smmoosavi/php-gettext-core
1 parent fe8ae83 commit 8e5356a

File tree

12 files changed

+23
-20
lines changed

12 files changed

+23
-20
lines changed

admin/edit_team.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ private function getOnDutyCandidates(Team $team, array $projList) {
493493
private function getOnDutyTasks(Team $team) {
494494

495495
$bugidList = $team->getOnDutyTasks();
496-
if (is_null($bugidList) || empty($bugidList)) { return NULL; }
496+
if (is_null($bugidList) || empty($bugidList)) { return array(); }
497497

498498
$onDutyTasks = array();
499499
foreach ($bugidList as $bugid) {

classes/controller.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function updateTeamSelector() {
7171
$this->session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
7272
$this->teamList = $this->session_user->getTeamList();
7373

74-
if (count($this->teamList) > 0) {
74+
if ((NULL != $this->teamList) && (count($this->teamList) > 0)) {
7575
$this->smartyHelper->assign('teams', SmartyTools::getSmartyArray($this->teamList, $_SESSION['teamid']));
7676
}
7777

i18n/gettext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function readintarray($count) {
9898
* @param object Reader the StreamReader object
9999
* @param boolean enable_cache Enable or disable caching of strings (default on)
100100
*/
101-
function gettext_reader($Reader, $enable_cache = true) {
101+
function __construct($Reader, $enable_cache = true) {
102102
// If there isn't a StreamReader, turn on short circuit mode.
103103
if (! $Reader || isset($Reader->error) ) {
104104
$this->short_circuit = true;
@@ -352,7 +352,7 @@ function get_plural_forms() {
352352
function select_string($n) {
353353
$string = $this->get_plural_forms();
354354
$string = str_replace('nplurals',"\$total",$string);
355-
$string = str_replace("n",$n,$string);
355+
$string = str_replace("n",(int)$n,$string);
356356
$string = str_replace('plural',"\$plural",$string);
357357

358358
$total = 0;

i18n/streams.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class StringReader {
4949
var $_pos;
5050
var $_str;
5151

52-
function StringReader($str='') {
52+
function __construct($str='') {
5353
$this->_str = $str;
5454
$this->_pos = 0;
5555
}
@@ -86,7 +86,7 @@ class FileReader {
8686
var $_fd;
8787
var $_length;
8888

89-
function FileReader($filename) {
89+
function __construct($filename) {
9090
if (file_exists($filename)) {
9191

9292
$this->_length=filesize($filename);
@@ -143,7 +143,7 @@ function close() {
143143
// Preloads entire file in memory first, then creates a StringReader
144144
// over it (it assumes knowledge of StringReader internals)
145145
class CachedFileReader extends StringReader {
146-
function CachedFileReader($filename) {
146+
function __construct($filename) {
147147
if (file_exists($filename)) {
148148

149149
$length=filesize($filename);

indicator_plugins/EffortEstimReliabilityIndicator/EffortEstimReliabilityIndicator.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getName() {
3636
return __CLASS__;
3737
}
3838
public static function getSmartyFilename() {
39-
return Constants::$codevRootDir.DS.self::indicatorPluginsDir.DS.__CLASS__.DS.__CLASS__.".html";
39+
return Constants::$codevRootDir.DIRECTORY_SEPARATOR.self::indicatorPluginsDir.DIRECTORY_SEPARATOR.__CLASS__.DIRECTORY_SEPARATOR.__CLASS__.".html";
4040
}
4141

4242
// ----------------------------------------------

indicator_plugins/StatusHistoryIndicator/StatusHistoryIndicator.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getName() {
5252
return __CLASS__;
5353
}
5454
public static function getSmartyFilename() {
55-
return Constants::$codevRootDir.DS.self::indicatorPluginsDir.DS.__CLASS__.DS.__CLASS__.".html";
55+
return Constants::$codevRootDir.DIRECTORY_SEPARATOR.self::indicatorPluginsDir.DIRECTORY_SEPARATOR.__CLASS__.DIRECTORY_SEPARATOR.__CLASS__.".html";
5656
}
5757

5858

plugins/StatusHistoryIndicator2/StatusHistoryIndicator2.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function initialize(PluginDataProviderInterface $pluginDataProv) {
130130
} else {
131131
$this->interval = 30;
132132
}
133-
$this->isDisplayResolved = fasle;
133+
$this->isDisplayResolved = false;
134134
//self::$logger->debug('dataProvider '.PluginDataProviderInterface::PARAM_INTERVAL.'= '.$this->interval);
135135
}
136136

plugins/TasksPivotTable/TasksPivotTable.class.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function setPluginSettings($pluginSettings) {
175175

176176
// cleanup selected filters (remove empty lines)
177177
$this->filterList = explode(',', $tmpSelectedFilters);
178-
$this->filterList = array_filter($this->filterList, create_function('$a','return $a!="";'));
178+
$this->filterList = array_filter($this->filterList, 'arrayFilter_fct');
179179
}
180180
}
181181
}
@@ -184,7 +184,7 @@ private function setDialogboxFilters() {
184184

185185
// cleanup allFilters (remove empty lines)
186186
$tmpList = explode(',', self::$allFilters);
187-
$tmpList = array_filter($tmpList, create_function('$a','return $a!="";'));
187+
$tmpList = array_filter($tmpList, 'arrayFilter_fct');
188188

189189
$allFilterList = array();
190190
foreach ($tmpList as $class_name) {
@@ -406,5 +406,9 @@ private function getIssues($explodeResults, $filterDisplayNames, $smartyVariable
406406

407407
}
408408

409+
function arrayFilter_fct($a) {
410+
return $a!="";
411+
}
412+
409413
// Initialize complex static variables
410414
TasksPivotTable::staticInit();

reports/check.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private function getTeamConsistencyErrors($teamid) {
7373

7474
$cerrList = $ccheck->check();
7575

76-
$cerrs = NULL;
76+
$cerrs = array();
7777
if (count($cerrList) > 0) {
7878
$i = 0;
7979
foreach ($cerrList as $cerr) {
@@ -117,4 +117,3 @@ private function getTeamConsistencyErrors($teamid) {
117117
$controller = new CheckController('../', 'Consistency Check','ConsistencyCheck');
118118
$controller->execute();
119119

120-
?>

reports/planning_report.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ private function getConsistencyErrors($teamid) {
220220
$cerrList = $ccheck->checkBadBacklog();
221221
#$cerrList2 = $ccheck->checkUnassignedTasks();
222222

223-
$consistencyErrors = NULL;
224-
if (count($cerrList) > 0 || count($cerrList2) > 0) {
225-
$consistencyErrors = array();
223+
$consistencyErrors = array();
224+
if (count($cerrList) > 0) {
225+
//if (count($cerrList) > 0 || count($cerrList2) > 0) {
226226
foreach ($cerrList as $cerr) {
227227
$user = UserCache::getInstance()->getUser($cerr->userId);
228228
$issue = IssueCache::getInstance()->getIssue($cerr->bugId);

smarty_tools.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static function getSmartyArray(array $list, $selected) {
7070
}
7171
return $smartyList;
7272
} else {
73-
return NULL;
73+
return array();
7474
}
7575
}
7676

tpl/form/selectItemsDialogbox.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@
163163
<fieldset>
164164
<div style="float:left;">
165165
<label for="sortableSource" id="availItemListLabel"></label>
166-
<ul id="sortableSource" class="sortable droptrue" style="height:{math equation="(x + y) * 37" x=$availItemList|count y=$selectedItemList|count}px">
166+
<ul id="sortableSource" class="sortable droptrue" style="height:10px">
167167
</ul>
168168
</div>
169169

170170
<div style="float:left;">
171171
<label for="sortableTarget" id="selectedItemListLabel"></label>
172-
<ul id="sortableTarget" class="sortable droptrue" style="height:{math equation="(x +y) * 37" x=$availItemList|count y=$selectedItemList|count}px">
172+
<ul id="sortableTarget" class="sortable droptrue" style="height:10px">
173173
</ul>
174174
</div>
175175
<!-- itemSelection_srcRef is a reference to identify the origin (projectid, cmdid, ...) -->

0 commit comments

Comments
 (0)