gantry5 icon indicating copy to clipboard operation
gantry5 copied to clipboard

Gantry Ajax Administration menu breaks

Open uGE70 opened this issue 2 years ago • 4 comments

Platform (Linux Debian, Infomaniak shared and Cloud Web hosting): Joomla 3.10.6 / 4.1.0, Gantry 5.5.11, all Gantry templates, PHP 8.0.17, no cache, no SEO plugin, default Joomla installation without any change.

Steps to reproduce Go to the Gantry manager and try to use the Ajax Gantry Administration menu, for instance switch to another layout using the dropdown menu or click on any menu tab.

Actual result I can't switch to another layout or to any tab like "Page settings" or "Outlines" using the Ajax menu. Error message displayed in the console is /administrator/index.php?option=com_gantry5&view=configurations/default/layout&theme=g5_hydrogen&1f063fc9781ab3c5897745ec0c6=1&format=json net::ERR_CONTENT_DECODING_FAILED 200 (see screenshot). Note: the json link returns a blank page. Copy and paste the URL displayed in the console without the json parameter and it's working. It's happening on all my Joonla 3/4 sites using PHP 8.0.17. It has been working fine on PHP 8 until a few days ago. Wordpress sites are working fine.

How to temporarily solve it

  • Rollback to PHP 7.4, which is working fine.

console

uGE70 avatar Mar 26 '22 10:03 uGE70

Hello, After some debugging, I found that the menu is working with PHP 8.0.17 when output_buffering = On (Joomla is recommending output_buffering = Off). Alternatively, it is also working with output_buffering = Off, for testing purposes, if I remove lines 73-78 in /libraries/gantry5/src/classes/Gantry/Component/Response/JsonResponse.php while (($output = ob_get_clean()) !== false) { // In debug mode send also output buffers (debug dumps, PHP notices and warnings). if ($output && (GANTRY5_DEBUG || headers_sent())) { $this->messages['php'][] = $output; } }

uGE70 avatar Apr 04 '22 07:04 uGE70

There's a bug in PHP 8.0.17 and PHP 8.1.4, see here https://github.com/php/php-src/issues/8218

mahagr avatar Apr 04 '22 07:04 mahagr

Thanks, yes it seems the culprit is not output_buffering like I thought but: zlib.output_compression = On

uGE70 avatar Apr 04 '22 07:04 uGE70

Yes, it's the output compression that is the issue. I hope they will fix the bug soon, though I may need to find a workaround in the meantime.

If you can, please use the previous version/patch from PHP or disable output compression from Joomla for now.

mahagr avatar Apr 04 '22 08:04 mahagr