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
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,7 @@ function _mysql_make_user($dbhandler,$db_host,$db_name,$login,$passwd) {
$safeLogin = $dbhandler->prepare_string($login);

$stmt = " CREATE USER '$safeLogin' ";
if (strlen(trim($db_host)) != 0) {
$stmt .= "@" . "'$safeDBHost'";
}
$stmt .= "@'%'"; // Docker: use wildcard host

// to guess if we are using MariaDB or MySQL
// does not seems to be a reliable way to do this
Expand Down Expand Up @@ -570,7 +568,7 @@ function _mysql_assign_grants($dbhandler,$db_host,$db_name,$login,$passwd) {
$safeLogin = $dbhandler->prepare_string($login);

$stmt = "GRANT SELECT, UPDATE, DELETE, INSERT ON
`$safeDBName`.* TO '$safeLogin'@'$safeDBHost'
`$safeDBName`.* TO '$safeLogin'@'%'
WITH GRANT OPTION ";

if ( !@$dbhandler->exec_query($stmt) ) {
Expand All @@ -590,7 +588,7 @@ function _mysql_assign_grants($dbhandler,$db_host,$db_name,$login,$passwd) {
//
if( strcasecmp('localhost',$db_host) != 0 ) {
$stmt = "GRANT SELECT, UPDATE, DELETE, INSERT ON
`$safeDBName`.* TO '$safeLogin'@'localhost'
`$safeDBName`.* TO '$safeLogin'@'%'
WITH GRANT OPTION ";

if ( !@$dbhandler->exec_query($stmt) ) {
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function testReportTCResultRequestWithBlockedStatus()
$response = $this->client->getResponse();
var_dump($response);
// Just check the size is good since we don't know the insert id
$this->assertEquals(3, sizeof($response[0]));
$this->assertEquals(3, sizeof((array)$response[0]));
}

function testReportTCResultRequestWithPassedStatus()
Expand All @@ -387,7 +387,7 @@ function testReportTCResultRequestWithPassedStatus()

$response = $this->client->getResponse();
// Just check the size is good since we don't know the insert id
$this->assertEquals(3, sizeof($response[0]));
$this->assertEquals(3, sizeof((array)$response[0]));
}

function testReportTCResultRequestWithFailedStatus()
Expand All @@ -407,7 +407,7 @@ function testReportTCResultRequestWithFailedStatus()

$response = $this->client->getResponse();
// Just check the size is good since we don't know the insert id
$this->assertEquals(3, sizeof($response[0]));
$this->assertEquals(3, sizeof((array)$response[0]));
}

function testReportTCResultWithNoParams()
Expand Down Expand Up @@ -448,7 +448,7 @@ function testReportTCResultValidRequest()

$response = $this->client->getResponse();
// Just check the size is good since we don't know the insert id
$this->assertEquals(3, sizeof($response[0]));
$this->assertEquals(3, sizeof((array)$response[0]));
}

function testGetLastTestResult()
Expand Down Expand Up @@ -480,7 +480,7 @@ function testGetLastTestResult()
$response = $this->client->getResponse();
// Just check the size is good since we don't know the insert id
print_r($response);
$this->assertEquals(9, sizeof($response[0]));
$this->assertEquals(9, sizeof((array)$response[0]));
$this->assertEquals('b', $response[0]['status']);

}
Expand All @@ -505,7 +505,7 @@ function testReportTCResultRequestWithValidBuildID()

$response = $this->client->getResponse();
// Just check the size is good since we don't know the insert id
$this->assertEquals(3, sizeof($response[0]));
$this->assertEquals(3, sizeof((array)$response[0]));
}

function testReportTCResultNotGuessingBuildID()
Expand Down Expand Up @@ -558,7 +558,7 @@ function testReportTCResultWithNotes()
// Just check the size is good since we don't know the insert id
var_dump($response);

$this->assertEquals(3, sizeof($response[0]));
$this->assertEquals(3, sizeof((array)$response[0]));
}

function testCreateBuildWithInsufficientRights()
Expand Down Expand Up @@ -593,7 +593,7 @@ function testCreateBuildWithoutNotes()
}
$response = $this->client->getResponse();
var_dump($response);
$this->assertEquals(3, sizeof($response[0]));
$this->assertEquals(3, sizeof((array)$response[0]));
}

function testCreateBuildWithNotes()
Expand All @@ -609,7 +609,7 @@ function testCreateBuildWithNotes()
$this->client->getErrorMessage();
}
$response = $this->client->getResponse();
$this->assertEquals(3, sizeof($response[0]));
$this->assertEquals(3, sizeof((array)$response[0]));
}

function testCreateBuildWithInvalidTPID()
Expand Down
Loading