From d72fca121fcc1602955d9319e872cbf76e8ecf2a Mon Sep 17 00:00:00 2001 From: Artyom Mezin Date: Tue, 22 Oct 2024 12:32:54 +0300 Subject: [PATCH 1/3] Annoying output comments fix for json Flex (#3856) --- system/src/Grav/Framework/Flex/FlexCollection.php | 2 +- system/src/Grav/Framework/Flex/FlexObject.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Framework/Flex/FlexCollection.php b/system/src/Grav/Framework/Flex/FlexCollection.php index 9d9fc477c..68110a645 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']->extension() !== '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..5cf838d63 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']->extension() !== 'json') { $name = $this->getKey() . ' (' . $type . ')'; $output = "\n\n{$output}\n\n"; } From 16a50767dd5ce1104a16c411890ed09219ee8695 Mon Sep 17 00:00:00 2001 From: Ricardo Verdugo Date: Tue, 22 Oct 2024 10:54:40 +0100 Subject: [PATCH 2/3] Fix JSON output comments check with content type (#3859) * Update FlexCollection.php * Update FlexObject.php (#3858) --- system/src/Grav/Framework/Flex/FlexCollection.php | 2 +- system/src/Grav/Framework/Flex/FlexObject.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Framework/Flex/FlexCollection.php b/system/src/Grav/Framework/Flex/FlexCollection.php index 68110a645..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() && $grav['uri']->extension() !== 'json') { + 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 5cf838d63..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() && $grav['uri']->extension() !== 'json') { + if ($debugger->enabled() && $grav['uri']->getContentType() !== 'application/json') { $name = $this->getKey() . ' (' . $type . ')'; $output = "\n\n{$output}\n\n"; } From 5a741d9b10906a6d391de0781549ddce2fe5ec9f Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 22 Oct 2024 12:05:21 +0100 Subject: [PATCH 3/3] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b7de3a4b..c4f7f2658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,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