Skip to content

Commit 9a2ea5d

Browse files
committed
FIX Uncaught TypeError: count() in \lib\functions\testproject.class.php
on line 305, 492, 688, 1987, 2573, 3270 and line 3336
1 parent 0f6b6c4 commit 9a2ea5d

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

lib/functions/testproject.class.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public function setSessionProject($projectId)
302302
* @param array $recorset produced by getTestProject()
303303
*/
304304
protected function parseTestProjectRecordset(&$recordset) {
305-
if (null != $recordset && count($recordset) > 0) {
305+
if (!empty($recordset)) {
306306
foreach ($recordset as $number => $row) {
307307
$recordset[$number]['opt'] = unserialize($row['options']);
308308
}
@@ -489,7 +489,7 @@ public function get_all($filters=null,$options=null)
489489
$this->parseTestProjectRecordset($recordset);
490490
} else {
491491
$recordset = $this->db->fetchRowsIntoMap($sql,$my['options']['access_key']);
492-
if (null != $recordset && count($recordset) > 0) {
492+
if (!empty($recordset)) {
493493
foreach ($recordset as $number => $row) {
494494
$recordset[$number]['opt'] = unserialize($row['options']);
495495
}
@@ -685,7 +685,7 @@ public function get_accessible_for_user($user_id,$opt = null,$filters = null) {
685685
case 'map_with_inactive_mark':
686686
default:
687687
$arrTemp = (array)$this->db->fetchRowsIntoMap($sql,'id');
688-
$do_post_process = (count($arrTemp) > 0);
688+
$do_post_process = !empty($arrTemp);
689689
break;
690690
}
691691

@@ -1984,7 +1984,7 @@ public function delete($id) {
19841984
$this->deleteAttachments($id);
19851985

19861986
$reqSpecSet=$reqspec_mgr->get_all_id_in_testproject($id);
1987-
if( !is_null($reqSpecSet) && count($reqSpecSet) > 0 ) {
1987+
if(!empty($reqSpecSet)) {
19881988
foreach($reqSpecSet as $reqSpec) {
19891989
$reqspec_mgr->delete_deep($reqSpec['id']);
19901990
}
@@ -2570,7 +2570,7 @@ public function getFreeTestCases($id,$options=null)
25702570
$free=$retval['allfree'] ? $all : array_diff_key($all,$linked);
25712571
}
25722572

2573-
if( !is_null($free) && count($free) > 0)
2573+
if(!empty($free))
25742574
{
25752575
$in_clause=implode(',',array_keys($free));
25762576
$sql = " /* $debugMsg */ " .
@@ -2592,9 +2592,7 @@ public function getFreeTestCases($id,$options=null)
25922592
}
25932593

25942594

2595-
// -------------------------------------------------------------------------------
25962595
// Custom field related methods
2597-
// -------------------------------------------------------------------------------
25982596
/*
25992597
function: get_linked_custom_fields
26002598
Get custom fields that has been linked to testproject.
@@ -3269,7 +3267,7 @@ private function _get_subtree_rec($node_id,&$pnode,$filters = null, $options = n
32693267
$highlander = $this->db->fetchRowsIntoMap($ssx,'tc_id');
32703268
if( $filterOnTC ) {
32713269
$ky = !is_null($highlander) ? array_diff_key($tclist,$highlander) : $tclist;
3272-
if( count($ky) > 0 ) {
3270+
if(!empty($ky)) {
32733271
foreach($ky as $tcase) {
32743272
unset($rs[$tcase]);
32753273
}
@@ -3335,7 +3333,7 @@ protected function getTCLatestVersionFilteredByKeywords($tproject_id, $keyword_i
33353333
if( $getWithOutKeywords || $keyword_filter_type == 'NotLinked') {
33363334

33373335
$this->get_all_testcases_id($tproject_id,$tcaseSet);
3338-
if( $hasTCases = count($tcaseSet) > 0 ) {
3336+
if($hasTCases = !empty($tcaseSet)) {
33393337
$delTT = true;
33403338
$tt = 'temp_tcset_' . $tproject_id . md5(microtime());
33413339
$sql = "CREATE TEMPORARY TABLE IF NOT EXISTS $tt AS

0 commit comments

Comments
 (0)