diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 1b3558cf4..b6ef2dafe 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -9886,10 +9886,14 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN { // Protection against wrong value type if (false === ($proposedValue instanceof ormPassword)) { + // On object creation, the attribute value is "" instead of an ormPassword... + if (is_string($proposedValue)) { + return utils::IsNotNullOrEmptyString($proposedValue); + } return parent::HasAValue($proposedValue); } - return $proposedValue->IsEmpty() !== false; + return $proposedValue->IsEmpty() === false; } } diff --git a/core/ormpassword.class.inc.php b/core/ormpassword.class.inc.php index 5faf263f6..343184ba3 100644 --- a/core/ormpassword.class.inc.php +++ b/core/ormpassword.class.inc.php @@ -66,7 +66,7 @@ class ormPassword public function IsEmpty() { - return ($this->m_hashed == null); + return utils::IsNullOrEmptyString($this->m_sHashed); } public function GetHash() diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php index c876fefce..624642a13 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php @@ -86,7 +86,7 @@ PHP, <<Get('contacts_list'); -\$ormLinkset->AddItem(MetaModel::NewObject('Person', [])); +\$ormLinkset->AddItem(MetaModel::NewObject('lnkContactToTicket', [])); \$oObject->Set('contacts_list', \$ormLinkset); PHP, false, @@ -164,7 +164,7 @@ PHP, 'UserLocal', 'password', <<Set('password', \$ormPassword); PHP, diff --git a/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php b/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php index 62c7262fd..403771b4d 100644 --- a/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php +++ b/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php @@ -99,7 +99,10 @@ class DataSynchroTest extends ItopDataTestCase $sUrl = \MetaModel::GetConfig()->Get('app_root_url').'/synchro/synchro_import.php?login_mode=form'; - $sResult = utils::DoPostRequest($sUrl, $aParams, null, $aResponseHeaders, []); + $sResult = utils::DoPostRequest($sUrl, $aParams, null, $aResponseHeaders, [ + CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_SSL_VERIFYHOST => 0, + ]); // Read the status code from the last line $aLines = explode("\n", trim(strip_tags($sResult))); //$sLastLine = array_pop($aLines);