diff --git a/CHANGELOG.md b/CHANGELOG.md index cc61d8bc9..d489a2358 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ 1. [](#bugfix) * Fixes deprecated for return type in Filesystem with PHP 8.3.6 [#3831](https://github.com/getgrav/grav/issues/3831) * Fix for `exif_imagtetype()` throwing an exception when file doesn't exist + * Fix JSON output comments check with content type [#3859](https://github.com/getgrav/grav/pull/3859) # v1.7.46 ## 05/15/2024 diff --git a/system/src/Grav/Framework/Flex/FlexCollection.php b/system/src/Grav/Framework/Flex/FlexCollection.php index 9d9fc477c..cfa91008e 100644 --- a/system/src/Grav/Framework/Flex/FlexCollection.php +++ b/system/src/Grav/Framework/Flex/FlexCollection.php @@ -440,7 +440,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface ] + $context ); - if ($debugger->enabled()) { + if ($debugger->enabled() && $grav['uri']->getContentType() !== 'application/json') { $output = "\n\n{$output}\n\n"; } diff --git a/system/src/Grav/Framework/Flex/FlexObject.php b/system/src/Grav/Framework/Flex/FlexObject.php index b93b6f219..58bd7eb4d 100644 --- a/system/src/Grav/Framework/Flex/FlexObject.php +++ b/system/src/Grav/Framework/Flex/FlexObject.php @@ -627,7 +627,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface ] + $context ); - if ($debugger->enabled()) { + if ($debugger->enabled() && $grav['uri']->getContentType() !== 'application/json') { $name = $this->getKey() . ' (' . $type . ')'; $output = "\n\n{$output}\n\n"; }