This problem was caused by WP Fastest Cache plugin the famous cache plugin with over 1 million active installations. Disabling all the options and testing one by one I’ve found that the problem happens when I flag one of these options:
- Minify Css
- Combine css files
- Combined js files
These options are critical in caching plugins because they do complex and potentially dangerous operations that modify the CSS files and Javascript files shrinking them. The minification process opens the CSS and reduce it to the minimal code necessary. This means that the code is cleaned from comments, cleaned from useless spaces, “;
” chars, tabs, new lines… For javascript minification the reduction is even more heavy because it changes also the names of the functions to reduce even more (the result is normally not easy to read by a human).
All the CSS reduced files (minified is the correct term) are then chained into a one single file to reduce the number of HTTP calls. The same is made by combining the Javascript minified files and making just one JS file.
This work is really awesome and very useful. But…
It may happen that the minification process brakes everything and causes the mysterious error: Fatal error: Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0.
These options normally works really fine, I’ve uses WP Fastest Cache plugin on many WordPress installations, I trust their developers!
I’ve found that the problem is within the script inclusion, I use inclusion directly in the footer.php
or in header.php
of my themes, like these:
<script type="text/javascript" loading="lazy" src="<?php
bloginfo("template_directory");
?>/js/main.js?v=07/11/2019"></script>
And the problem happened due to the “/
” chars in the version parameter (I sometimes put the date as version parameter). Removing the “/
” solved the issue.
I don’t know if someone else ever found this problem.