Skip to content

Commit 7716594

Browse files
[Config] Add missing json_encode flag when creating .meta.json files
1 parent bcd3c4a commit 7716594

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ResourceCheckerConfigCache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function write(string $content, ?array $metadata = null): void
128128
$ser = preg_replace_callback('/;O:(\d+):"/', static fn ($m) => ';O:'.(9 + $m[1]).':"Tracking\\', $ser);
129129
$ser = preg_replace_callback('/s:(\d+):"\0[^\0]++\0/', static fn ($m) => 's:'.($m[1] - \strlen($m[0]) + 6).':"', $ser);
130130
$ser = unserialize($ser);
131-
$ser = @json_encode($ser) ?: [];
131+
$ser = @json_encode($ser, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE) ?: [];
132132
$ser = str_replace('"__PHP_Incomplete_Class_Name":"Tracking\\\\', '"@type":"', $ser);
133133
$ser = \sprintf('{"resources":%s}', $ser);
134134

Tests/ResourceCheckerConfigCacheTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,6 @@ public function testCacheWithCustomMetaFile()
168168
'resource' => __FILE__,
169169
],
170170
],
171-
]));
171+
], \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
172172
}
173173
}

0 commit comments

Comments
 (0)