diff --git a/core/dbobject.class.php b/core/dbobject.class.php index fdf8ddba3..d4f2535cb 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -2297,15 +2297,19 @@ abstract class DBObject implements iDisplay continue; } - /** @noinspection NotOptimalIfConditionsInspection */ - /** @noinspection TypeUnsafeComparisonInspection */ if (utils::IsNullOrEmptyString($sRemoteObjectClass) || utils::IsNullOrEmptyString($sRemoteObjectKey) - || ($sRemoteObjectKey == 0) // non-strict comparison as we might have bad surprises ) { continue; } + // 0 : Undefined ext. key (EG. non-mandatory and no value provided) + // < 0 : Non yet persisted object + /** @noinspection TypeUnsafeComparisonInspection Non-strict comparison as object ID can be string */ + if ($sRemoteObjectKey <= 0) { + continue; + } + if (false === $oIsObjectLoadableCallback($sRemoteObjectClass, $sRemoteObjectKey)) { throw new InvalidExternalKeyValueException($this, $sAttDefCode); }