joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[4.2.2] Serialization Error when using mod_articles_categories with cache

Open sakicnet opened this issue 2 years ago • 3 comments

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.

sakicnet avatar Sep 18 '22 18:09 sakicnet

confirmed probably regression from #37139

alikon avatar Sep 19 '22 07:09 alikon

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.

tramber91 avatar Sep 20 '22 00:09 tramber91

+1

caglayanevren avatar Sep 22 '22 09:09 caglayanevren

Confirmed for J4.2.3 stable, PHP 8.1

ReLater avatar Oct 09 '22 20:10 ReLater

Will this B/C break be mitigated?

SharkyKZ avatar Nov 25 '22 09:11 SharkyKZ

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.

mrownicki avatar Dec 13 '22 10:12 mrownicki

Bug present on Joomla 4.2.9 too. Will there be a solution, because not use cache is not a solution ?!

Sabrina-Travail-Lewagon avatar Mar 17 '23 11:03 Sabrina-Travail-Lewagon

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.

Vegaturk avatar Mar 19 '23 15:03 Vegaturk

@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 avatar Mar 31 '23 14:03 joomdonation

@joomdonation Will do by Monday, please hold on.

Denitz avatar Mar 31 '23 14:03 Denitz

Great. Many thanks @Denitz

joomdonation avatar Mar 31 '23 14:03 joomdonation

@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 avatar Mar 31 '23 16:03 Denitz

@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).

joomdonation avatar Mar 31 '23 16:03 joomdonation

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 avatar Mar 31 '23 16:03 Denitz

@Denitz Please make PR. I will test it myself and find someone to test it, too. We should have this fixed ASAP.

joomdonation avatar Mar 31 '23 16:03 joomdonation

i'll test that too @Denitz

alikon avatar Mar 31 '23 17:03 alikon

Many thanks for your help, I will add a PR by the end of Monday, hope tomorrow, please hold on...

Denitz avatar Mar 31 '23 20:03 Denitz

@joomdonation @alikon https://github.com/joomla/joomla-cms/pull/40275

Denitz avatar Apr 01 '23 08:04 Denitz

@Sabrina-Travail-Lewagon @Vegaturk Please test PR https://github.com/joomla/joomla-cms/pull/40275 . It should solve your issue. Thanks !

joomdonation avatar Apr 01 '23 15:04 joomdonation

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

Vegaturk avatar Apr 19 '23 22:04 Vegaturk

Sure, the patch was not merged into 4.3.0, I guess we can wait for a year.

Denitz avatar Apr 20 '23 05:04 Denitz