Skip to content

Commit

Permalink
部分场景 JSON 操作出错抛出异常、不转义“/”和 Unicode (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft authored Oct 30, 2021
1 parent e3b3332 commit bea815f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Db/Query/Builder/UpdateBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function build(...$args): string
{
$jsonSets[$field][] = [
'jsonKeywords' => $matches['jsonKeywords'],
'raw' => 'jsonb(\'' . json_encode($v) . '\'::TEXT)',
'raw' => 'jsonb(\'' . json_encode($v, \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE) . '\'::TEXT)',
];
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Cli/Model/ModelGenerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public function generate(string $namespace, string $baseClass, ?string $database
case 'model':
break;
default:
$override = (bool) json_decode($override);
$override = (bool) json_decode($override, false);
}
if (\in_array($config, ['true', 'false'], true))
{
$config = (bool) json_decode($config);
$config = (bool) json_decode($config, false);
}
if (true === $config)
{
Expand Down

0 comments on commit bea815f

Please sign in to comment.