Skip to content

Commit

Permalink
[Config] Add missing json_encode flag when creating .meta.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jan 22, 2025
1 parent bcd3c4a commit 7716594
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ResourceCheckerConfigCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function write(string $content, ?array $metadata = null): void
$ser = preg_replace_callback('/;O:(\d+):"/', static fn ($m) => ';O:'.(9 + $m[1]).':"Tracking\\', $ser);
$ser = preg_replace_callback('/s:(\d+):"\0[^\0]++\0/', static fn ($m) => 's:'.($m[1] - \strlen($m[0]) + 6).':"', $ser);
$ser = unserialize($ser);
$ser = @json_encode($ser) ?: [];
$ser = @json_encode($ser, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE) ?: [];
$ser = str_replace('"__PHP_Incomplete_Class_Name":"Tracking\\\\', '"@type":"', $ser);
$ser = \sprintf('{"resources":%s}', $ser);

Expand Down
2 changes: 1 addition & 1 deletion Tests/ResourceCheckerConfigCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ public function testCacheWithCustomMetaFile()
'resource' => __FILE__,
],
],
]));
], \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
}
}

0 comments on commit 7716594

Please sign in to comment.