From 08e8d15d78e97452eb57d9cbfd5a02cea43952d2 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Mon, 4 Dec 2023 22:28:26 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B07023=20-=20Fix=20check=20to=20write=20er?= =?UTF-8?q?ror=20when=20adding=20a=20contact=20on=20a=20new=20user=20reque?= =?UTF-8?q?st=20on=20the=20end-users=20portal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dbobject.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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); }