Skip to content

Commit 703a993

Browse files
committed
Fix for json_decode
Check the var type before using json_decode.
1 parent 7793b2a commit 703a993

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Extension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function initialize()
5959
public function contentParser(Content $content)
6060
{
6161
foreach ($content->contenttype['fields'] as $key => $options) {
62-
if ($options['type'] == 'array') {
62+
if ($options['type'] == 'array' && is_string($content->values[$key])) {
6363
$values = json_decode($content->values[$key], true);
6464
$content->values[$key] = array_values($values);
6565
}
@@ -84,7 +84,7 @@ public function getChildrenContexts(array $context, $key)
8484
$values = array();
8585
if (array_key_exists($key, $parentValues)) {
8686
$json = json_decode($parentValues[$key], true);
87-
$values = ($json) ? array_values($json) : array();
87+
$values = $json?array_values($json):array();
8888
}
8989

9090
foreach ($values as $num => $vFields) {

0 commit comments

Comments
 (0)