Skip to content

Commit 7d7cf79

Browse files
authored
Merge pull request kvnZero#17 from kvnZero/feat/代码优化
update 满足json才进行替换
2 parents 19f9db0 + 31f8500 commit 7d7cf79

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/Listener/QueryResultTryToJsonListener.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ public function process(object $event)
3535
return !isset($item['native_type']) && in_array('blob', $item['flags']);
3636
}, ARRAY_FILTER_USE_BOTH) as $item) {
3737
for ($i = 0; $i < count($event->result); $i++) {
38-
$event->result[$i][$item['name']] = json_decode($event->result[$i][$item['name']], true);
38+
if (!is_string($event->result[$i][$item['name']])) continue;
39+
$jsonData = json_decode($event->result[$i][$item['name']], true);
40+
if (is_array($jsonData)) {
41+
$event->result[$i][$item['name']] = $jsonData;
42+
}
3943
}
4044
}
4145
}

0 commit comments

Comments
 (0)