Skip to content

Commit b765290

Browse files
bug symfony#59580 [Config] Add missing json_encode flags when creating .meta.json files (nicolas-grekas)
This PR was merged into the 7.2 branch. Discussion ---------- [Config] Add missing `json_encode` flags when creating `.meta.json` files | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT So that cache:clear can find refs to `var/cache/de_` and patch them. (currently it fails as those are encoded as `var\/cache\/de_`.) Commits ------- 23f05ac [Config] Add missing json_encode flag when creating .meta.json files
2 parents 1b22bbe + 23f05ac commit b765290

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Config/ResourceCheckerConfigCache.php

Lines changed: 1 addition & 1 deletion
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

src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php

Lines changed: 1 addition & 1 deletion
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)