joomla-cms
joomla-cms copied to clipboard
[4.2.2] Serialization Error when using mod_articles_categories with cache
Steps to reproduce the issue
- Turn on caching in Global Configuration.
- Publish mod_articles_categories module and set it to display all categories.
- Reload the frontend and you will get following error: Serialization of 'Closure' is not allowed
Expected result
Displaying list of categories.
Actual result
Error 500: Serialization of 'Closure' is not allowed
System information (as much as possible)
The bug is present in prod 4.2.2 and 4.2.3-dev
Additional comments
The bug was not present in 4.1.5 version.
confirmed probably regression from #37139
Confirm also, in joomla 4.2.2 (php 8) I have a blank page with a mod_articles_categories (No error message on my side even if error is enable, just blank page) If, in advanced Tab option of the module mod_articles_categories, Caching, i enter "No Caching" I can load my page without issue
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38782.
+1
Confirmed for J4.2.3 stable, PHP 8.1
Will this B/C break be mitigated?
Confirm this buq still exist. Joomla 4.2.5 and PHP 8
Serialization of 'Closure' is not allowed /public_html/libraries/src/Cache/Controller/CallbackController.php:156
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38782.
Bug present on Joomla 4.2.9 too. Will there be a solution, because not use cache is not a solution ?!
The bug still persists in version 4.2.9 I think there is information that they will fix this problem in version 4.3.0
Until we fix this issue in version 4.3.0 the workaround is to disable cache in articles-categories module
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38782.
@Denitz Could you please take a look at this issue to see if it is related to your PR https://github.com/joomla/joomla-cms/pull/37139 and hopefully come up with a solution ? Thanks !
@joomdonation Will do by Monday, please hold on.
Great. Many thanks @Denitz
@joomdonation The issue is unrelated, it's invalid module code: module helper caches array of Joomla\CMS\Categories\CategoryNode
objects and each object has _constructor
property of Joomla\Component\Content\Site\Service\Category
type which can't be serialized because it contains database layer instance and other garbage.
Joomla\Module\ArticlesCategories\Site\Helper\ArticlesCategoriesHelper::getList()
should just return array of simple stdClasses
@Denitz Thanks for the info. Asked you to look at it because someone mentioned reverting your PR solves the issue (haven't really tested it).
The issue raised after Jun 18, 2022 via injecting database instance into Categories (via DatabaseAwareTrait
) which are stored in node as _constructor
property.
The module cache should not serialize database layer, it's ridiculous and just impossible because layer contains non-serialazable objects like i.e. PDOStatement
.
Here is this commit: https://github.com/joomla/joomla-cms/commit/26c634184ebf532f922e07319a157c6ef417f6bd
I can do a PR and change the mod_articles_categories cached data to simple stdClass
, but only if this PR will be actually merged but not hang around for months/years like other PRs :(
@Denitz Please make PR. I will test it myself and find someone to test it, too. We should have this fixed ASAP.
i'll test that too @Denitz
Many thanks for your help, I will add a PR by the end of Monday, hope tomorrow, please hold on...
@joomdonation @alikon https://github.com/joomla/joomla-cms/pull/40275
@Sabrina-Travail-Lewagon @Vegaturk Please test PR https://github.com/joomla/joomla-cms/pull/40275 . It should solve your issue. Thanks !
I have installed version 4.3.0 with great hope that the error can be fixed, I disabled the caching of the module, I turned on caching again, but unfortunately the error persists. 0 Serialization of 'Closure' is not allowed
Sure, the patch was not merged into 4.3.0, I guess we can wait for a year.