Skip to content

Commit 1bb17bb

Browse files
committed
Handle the case when null given
1 parent a20439e commit 1bb17bb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/SWP/Bundle/ContentBundle/Model/Article.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,11 @@ public function setExtraFields(array $extra): void
538538
if (is_array($value)) {
539539
$this->addEmbedExtra(ArticleExtraEmbedField::newFromValue($key, $value));
540540
} else {
541-
if(is_int($value)) {
542-
$value = (string)$value;
541+
// Coerce null and non-string scalars to string to satisfy strict types
542+
if ($value === null) {
543+
$value = '';
544+
} elseif (!is_string($value)) {
545+
$value = (string) $value;
543546
}
544547
$this->addTextExtra(ArticleExtraTextField::newFromValue($key, $value));
545548
}

0 commit comments

Comments
 (0)