XoopsModules25x / publisher

Publishing module for XOOPS for static/HTML content and articles stored and provided in a hierarchical manner
6 stars 25 forks source link

Block editing breaks the site with memory exhaustion when the user has uid = 1 #176

Open walkero-gr opened 1 month ago

walkero-gr commented 1 month ago

There is a problem with the module when a user with uid = 1 tries to edit the blocks. The code goes into an infinite loop in the categories field and then gives 500 error with a message like below

PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /var/www/clients/client3/web60/web/class/logger/render.php on line 1, referer: https://www.amigans.net/modules/system/admin.php?fct=blocksadmin

I tracked it down to the following part of the code, which when I disabled it everything worked fine. https://github.com/XoopsModules25x/publisher/blob/1.07_FINAL/class/CategoryHandler.php#L214-L216

My question is why this takes in consideration the uid and what is the purpose of this code. Because, as much as I understand it, this returns all the categories, no matter their level, and then the code that gets the subdomains loops indefinitely.

I noticed that this code is in the latest code in the master branch. Maybe that bug exists even in newer versions, which I haven't tested.

My test environment: PHP 7.3 Xoops 2.5.10 Publisher 1.07 FINAL