mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 01:28:47 +02:00
PHP 7.2 compatibility: count(null) now generates a PHP warning !!
SVN:trunk[5815]
This commit is contained in:
@@ -2367,7 +2367,7 @@ EOF
|
||||
else
|
||||
{
|
||||
$aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, $aArgs);
|
||||
if (count($aAllowedValues) == 1)
|
||||
if (is_array($aAllowedValues) && (count($aAllowedValues) == 1))
|
||||
{
|
||||
$aValues = array_keys($aAllowedValues);
|
||||
$oObj->Set($sAttCode, $aValues[0]);
|
||||
@@ -3461,7 +3461,7 @@ EOF
|
||||
foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance)
|
||||
{
|
||||
$aNewIssues = $oExtensionInstance->OnCheckToWrite($this);
|
||||
if (count($aNewIssues) > 0)
|
||||
if (is_array($aNewIssues) && (count($aNewIssues) > 0)) // Some extensions return null instead of an empty array
|
||||
{
|
||||
$this->m_aCheckIssues = array_merge($this->m_aCheckIssues, $aNewIssues);
|
||||
}
|
||||
|
||||
@@ -1234,7 +1234,7 @@ abstract class DBObject implements iDisplay
|
||||
elseif ($oAtt->IsScalar())
|
||||
{
|
||||
$aValues = $oAtt->GetAllowedValues($this->ToArgsForQuery());
|
||||
if (count($aValues) > 0)
|
||||
if (is_array($aValues) && (count($aValues) > 0))
|
||||
{
|
||||
if (!array_key_exists($toCheck, $aValues))
|
||||
{
|
||||
|
||||
@@ -6185,7 +6185,7 @@ abstract class MetaModel
|
||||
{
|
||||
$sQuerySign .= '_all_';
|
||||
}
|
||||
if (count($aModifierProperties))
|
||||
if (is_array($aModifierProperties) && (count($aModifierProperties) > 0))
|
||||
{
|
||||
array_multisort($aModifierProperties);
|
||||
$sModifierProperties = json_encode($aModifierProperties);
|
||||
|
||||
@@ -457,7 +457,8 @@ class SearchForm
|
||||
|
||||
$aAllowedValues = $oAttrDef->GetAllowedValues();
|
||||
|
||||
return array('values' => $aAllowedValues, 'count' => count($aAllowedValues));
|
||||
$iCount = is_array($aAllowedValues) ? count($aAllowedValues) : 0;
|
||||
return array('values' => $aAllowedValues, 'count' => $iCount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -668,4 +669,4 @@ class SearchForm
|
||||
return $aOrCriterion;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user