Php8 compatibility fixes by hupendrad4 · Pull Request #411 · TestLinkOpenSourceTRMS/testlink-code · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions install/installUtils.php
2 changes: 1 addition & 1 deletion lib/ajax/getreqcoveragenodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function display_children($dbHandler,$root_node,$parent,$filter_node,
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
if(!is_null($req_list))
{
$item_qty = count($req_list);
$item_qty = count((array)$req_list);
$path['text'] .= " ({$item_qty})";
}
break;
Expand Down
2 changes: 1 addition & 1 deletion lib/ajax/getrequirementnodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function display_children($dbHandler,$root_node,$parent,$filter_node,
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
if(!is_null($req_list))
{
$item_qty = count($req_list);
$item_qty = count((array)$req_list);
$path['text'] .= " ({$item_qty})";
}
break;
Expand Down
4 changes: 2 additions & 2 deletions lib/ajax/gettprojectnodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function display_children($dbHandler,$root_node,$parent,$filter_node,
case 'testsuite':
$items = array();
getAllTCasesID($row['id'],$items);
$tcase_qty = sizeof($items);
$tcase_qty = sizeof((array)$items);

$path['href'] = "javascript:" . $js_function[$row['node_type']]. "({$path['id']})";
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
Expand Down Expand Up @@ -195,7 +195,7 @@ function getAllTCasesID($idList,&$tcIDs) {
$suiteIDs[] = $row['id'];
}
}
if (sizeof($suiteIDs)) {
if (sizeof((array)$suiteIDs)) {
$suiteIDs = implode(",",$suiteIDs);
getAllTCasesID($suiteIDs,$tcIDs);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/api/rest/v1/tlRestApi.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function getProjectTestPlans($idCard)
if( !is_null($tproject) )
{
$items = $this->tprojectMgr->get_all_testplans($tproject[0]['id']);
$op['items'] = (!is_null($items) && count($items) > 0) ? $items : null;
$op['items'] = (!is_null($items) && count((array)$items) > 0) ? $items : null;
}
else
{
Expand Down Expand Up @@ -290,7 +290,7 @@ public function getProjectTestCases($idCard)
{
$tcaseIDSet = array();
$this->tprojectMgr->get_all_testcases_id($tproject[0]['id'],$tcaseIDSet);
if( !is_null($tcaseIDSet) && count($tcaseIDSet) > 0 )
if( !is_null($tcaseIDSet) && count((array)$tcaseIDSet) > 0 )
{
$op['items'] = array();
foreach( $tcaseIDSet as $key => $tcaseID )
Expand Down
10 changes: 5 additions & 5 deletions lib/api/rest/v2/tlRestApi.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public function getProjectTestPlans($idCard) {

if( !is_null($tproject) ) {
$items = $this->tprojectMgr->get_all_testplans($tproject['id']);
$op['items'] = (!is_null($items) && count($items) > 0) ? $items : null;
$op['items'] = (!is_null($items) && count((array)$items) > 0) ? $items : null;
} else {
$op['message'] = "No Test Project identified by '" . $idCard . "'!";
$op['status'] = 'error';
Expand All @@ -352,7 +352,7 @@ public function getProjectTestCases($idCard) {
$tcaseIDSet = array();
$this->tprojectMgr->get_all_testcases_id($tproject['id'],$tcaseIDSet);

if( !is_null($tcaseIDSet) && count($tcaseIDSet) > 0 ) {
if( !is_null($tcaseIDSet) && count((array)$tcaseIDSet) > 0 ) {
$op['items'] = array();
foreach( $tcaseIDSet as $key => $tcaseID ) {
$item = $this->tcaseMgr->get_last_version_info($tcaseID);
Expand Down Expand Up @@ -1010,7 +1010,7 @@ private function buildTestCaseObj(&$obj) {

if(!$attrOK) {
$msg = "Attribute: {$key} mandatory key (";
if(count($attr) > 1) {
if(count((array)$attr) > 1) {
$msg .= "one of set: ";
}
$msg .= implode('/',$attr) . ") is missing";
Expand Down Expand Up @@ -1236,7 +1236,7 @@ public function getPlanBuilds($idCard) {

if( !is_null($tplan) ) {
$items = $this->tplanMgr->get_builds($tplan['id']);
$op['items'] = (!is_null($items) && count($items) > 0) ? $items : null;
$op['items'] = (!is_null($items) && count((array)$items) > 0) ? $items : null;
} else {
$op['message'] = "No Test Plan identified by '" . $idCard . "'!";
$op['status'] = 'error';
Expand Down Expand Up @@ -1531,7 +1531,7 @@ public function addPlatformsToTestPlan($tplan_id) {
$p2link[$plat_id]=$plat_id;
}
}
if (count($p2link) >0){
if (count((array)$p2link) >0){
$platMgr->linkToTestplan($p2link,$tplan_id);
}
}
Expand Down
12 changes: 6 additions & 6 deletions lib/api/rest/v3/RestApi.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private function getProjects($idCard=null, $opt=null)
{
$options = array_merge(array('output' => 'rest'), (array)$opt);
$op = array('status' => 'ok', 'message' => 'ok', 'item' => null);
if(is_null($idCard) || count($idCard) == 0) {
if(is_null($idCard) || count((array)$idCard) == 0) {
$opOptions = array('output' => 'array_of_map',
'order_by' => " ORDER BY name ",
'add_issuetracker' => true,
Expand Down Expand Up @@ -337,7 +337,7 @@ public function getProjectTestCases(Request $request, Response $response, $idCar
$tcaseIDSet = array();
$this->tprojectMgr->get_all_testcases_id($tproject['id'],$tcaseIDSet);

if( !is_null($tcaseIDSet) && count($tcaseIDSet) > 0 ) {
if( !is_null($tcaseIDSet) && count((array)$tcaseIDSet) > 0 ) {
$op['items'] = array();
foreach( $tcaseIDSet as $key => $tcaseID ) {
$item = $this->tcaseMgr->get_last_version_info($tcaseID);
Expand Down Expand Up @@ -427,7 +427,7 @@ public function getProjectTestPlans(Request $request,

if( !is_null($tproj) ) {
$items = $this->tprojectMgr->get_all_testplans($tproj['id']);
$op['items'] = (!is_null($items) && count($items) > 0)
$op['items'] = (!is_null($items) && count((array)$items) > 0)
? $items : null;
} else {
$op['message'] = "No Test Project identified by '" . $idCard . "'!";
Expand Down Expand Up @@ -455,7 +455,7 @@ public function getPlanBuilds(Request $request,

if( !is_null($tplan) ) {
$items = $this->tplanMgr->get_builds($tplan['id']);
$op['items'] = (!is_null($items) && count($items) > 0)
$op['items'] = (!is_null($items) && count((array)$items) > 0)
? $items : null;
} else {
$op['message'] = "No Test Plan identified by API KEY:" .
Expand Down Expand Up @@ -1107,7 +1107,7 @@ public function addPlatformsToTestPlan(Request $request,
$p2link[$plat_id]=$plat_id;
}
}
if (count($p2link) >0){
if (count((array)$p2link) >0){
$platMgr->linkToTestplan($p2link,$tplan_id);
}
}
Expand Down Expand Up @@ -1364,7 +1364,7 @@ private function buildTestCaseObj(&$obj)

if(!$attrOK) {
$msg = "Attribute: {$key} mandatory key (";
if(count($attr) > 1) {
if(count((array)$attr) > 1) {
$msg .= "one of set: ";
}
$msg .= implode('/',$attr) . ") is missing";
Expand Down
2 changes: 1 addition & 1 deletion lib/api/rest/v3/custom/api/RestApiCustomExample.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
$bd = dirname(__FILE__);
$ds = DIRECTORY_SEPARATOR;
$dummy = explode($ds. lib . $ds, $bd);
$dummy = explode($ds . 'lib' . $ds, $bd);
require_once($dummy[0] . $ds . 'config.inc.php');
require_once('common.php');

Expand Down
2 changes: 1 addition & 1 deletion lib/api/xmlrpc/v1/poc/php/example01/autom01.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}
}
}
$whatWillBeDone .= count($actions) ? implode('<br>',$actions) : 'Nothing!!';
$whatWillBeDone .= count((array)$actions) ? implode('<br>',$actions) : 'Nothing!!';
echo $whatWillBeDone . '<br>';

foreach( $phpSteps as $m2i)
Expand Down
2 changes: 1 addition & 1 deletion lib/api/xmlrpc/v1/sample_clients/php/clientGetProjects.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
$answer = runTest($client,$method,$args);
new dBug($answer);

$items_qty = count($answer);
$items_qty = count((array)$answer);
foreach($answer as $item)
{
if( isset($item['name']) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
$originalSteps = (array)$ret['steps'];
}

if( ($loop2do = count($originalSteps)) > 0 )
if( ($loop2do = count((array)$originalSteps)) > 0 )
{
$runDelete = true;
$allSteps = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private function _getTestSuiteByName($args) {

$result = $this->tsuiteMgr->get_by_name($testSuiteName);

$num = sizeof($result);
$num = sizeof((array)$result);
if ($num == 0) {
$msg = $msg_prefix . sprintf("Name %s does not belong to a test suite present on system!", $testSuiteName);
$this->errors[] = new IXR_Error(8004, $msg);
Expand Down
18 changes: 9 additions & 9 deletions lib/api/xmlrpc/v1/test/TestlinkXMLRPCServerTest.php
Loading