Skip to content

Commit 11c0f14

Browse files
Moussa Sidibesidibos
authored andcommitted
SDK-603: Add error handling for JSON converter
1 parent 8e4acfd commit 11c0f14

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

sandbox/src/Entity/SandboxDocumentDetails.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class SandboxDocumentDetails extends DocumentDetails
88
{
99
public function getValue()
1010
{
11-
$value = $this->getType() . ' ' . $this->getIssuingAuthority() . ' ' . $this->getDocumentNumber() . ' ';
11+
$value = $this->getType() . ' ' . $this->getIssuingCountry() . ' ' . $this->getDocumentNumber() . ' ';
1212

1313
$expirationDate = $this->getExpirationDate();
1414
$value .= (NULL !== $expirationDate) ? $expirationDate->format('d-m-Y') : '-';

src/Yoti/Util/Age/AgeVerificationConverter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function getAgeVerificationsFromAttrsMap()
4040
$abstractAgeProcessorClass = '\\Yoti\\Util\\Age\\AbstractAgeProcessor';
4141
if (
4242
NULL !== $attrName
43+
&& NULL !== $attributeObj
4344
&& is_subclass_of($ageProcessorClass, $abstractAgeProcessorClass)
4445
)
4546
{

src/Yoti/Util/Profile/AttributeConverter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ private static function convertValueBasedOnContentType(ProtobufAttribute $protob
6464
case self::CONTENT_TYPE_JSON:
6565
// Convert JSON string to an array
6666
$value = json_decode($value, true);
67+
if (json_last_error()) {
68+
throw new AttributeException("Error converting attr {$attrName} to a JSON Object");
69+
}
6770
break;
6871

6972
case self::CONTENT_TYPE_DATE:

0 commit comments

Comments
 (0)