JoshyPHP wrote: ↑Wed Feb 26, 2020 8:20 pm
If there's any way to reproduce that error on a recent version of phpBB I'd be interested in that template.
That said, the most recent version of phpBB that contains those instructions at the lines referenced in those error messages is phpBB 3.2.5, from 2018. This is not phpBB 3.2.9.
This post is a while ago, but I have come across this problem as well now in phpBB 3.3.2 on PHP 7.4 when updating my forum from phpBB 3.1.x. This is only an educated guess, but to me, the error seems to be related to the number of smilies in the board and ocurrs when parsing the forum description texts, based on the huge PHP string it tries to optimize when it crashes and the resulting index.php html when I replace it by an empty string.
I put an echo of the input string into the optimize function where it crashed. As a result, it dumped a bunch of strings, the relevant long one starting with:
Code: Select all
if($this->params['S_VIEWSMILIES']===''){$this->out.=htmlspecialchars($node->textContent,0);}else{switch($node->textContent){case'8)':$this->out.='<'.htmlspecialchars('img',3);$this->out.=' '
This is followed by an extremely long (>620.000 characters!) switch case with I assume all smilies of the board. This is quite a huge number on mine (19 pages worth in the ACP), and therefore, it crashed with:
Allowed memory size of 67108864 bytes exhausted (tried to allocate 8388616 bytes) in [ROOT]vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Optimizer.php on line 57
Since the amount of memory requested is not exactly small, I am guessing this needs some sort of optimization.
Now I temporarily "solved" this by having the function return an empty string as result (increasing the memory limit is right now not really an option and returning the original string shifts the problem to a different function), but obviously that leads to the index.php and viewforum.php having some empty spots where actually there should be forum descriptions, which use BBcodes & smilies.
Maybe it would be better to not put all smilies in a big switch case to be parsed or have it optimized in two steps using placeholders, so each case doesn't need so much code with all these htmlspecialchars elements.
In case you actually do need the whole string somehow, you can find that here (it has all the output I got before crashing when viewing my index.php directly after cache was deleted, the line it crashed on is the 5th):
https://www.phpbb.de/pastebin/?mode=view&s=69. Be careful when you open this, it is a huge page, the code to optimize has more than 620.000 characters.
EDIT: Since you asked for a sample: The only code on the index.php I found using BBcodes & smilies was one Forum description which had a coloring in it, it didn't even have smilies actually.