No Code Attached Yet
avatar ReLater
ReLater
9 Oct 2022

Steps to reproduce the issue

While debugging, I stumbled across this known bug and disabled caching for the affected mod_articles_categories, which was followed by a deprecated message that can be reproduced as follows.

  • Joomla 4.2.3
  • PHP 8.1
  • Joomla configuration: Activate progressive caching (see image below).
  • !!Clear Joomla Cache!!
  • Frontend: Open a page with modules where caching is not disabled (don't know if that matters).
  • With hardly configured n3t debug plugin I get
Deprecated: Automatic conversion of false to array is deprecated
File: libraries/src/Document/HtmlDocument.php:561

See also images.

grafik

grafik

grafik

avatar ReLater ReLater - open - 9 Oct 2022
avatar joomla-cms-bot joomla-cms-bot - change - 9 Oct 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 9 Oct 2022
avatar ReLater ReLater - change - 10 Oct 2022
Title
[4.2.3] Progressive caching. Automatic conversion of false to array is deprecated
[4.2.3] PHP 8.1. Progressive caching. Automatic conversion of false to array is deprecated
avatar ReLater ReLater - edited - 10 Oct 2022
avatar richard67
richard67 - comment - 12 Oct 2022

$cbuffer can only be boolean false if the call to $cache->get in line 545 returns false, which is the case when caching is switched off, but then we should not be in that branch of the if statement.

A bit below that line, in line 548 the method returns when $cbuffer[$hash] is set.

So it seems that after that line we can assume that the $cbuffer was not properly set.

If my assumption is true, it is maybe sufficient and correct just to add a line $cbuffer = []; (or $cbuffer = array(); if keeping the old array syntax like elsewhere in that file) before line 561.

@Fedik What do you think? Can it be solved like this?

avatar Fedik
Fedik - comment - 12 Oct 2022

Yeap, and I would initialise it on get()

$cbuffer = $cache->get('cbuffer_' . $type);

Kind of:

$cbuffer = $cache->get('cbuffer_' . $type) ?: [];
avatar richard67
richard67 - comment - 12 Oct 2022

@Fedik Would be cool if you could make a PR.

avatar Fedik Fedik - change - 12 Oct 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-10-12 12:36:28
Closed_By Fedik
avatar Fedik Fedik - close - 12 Oct 2022
avatar Fedik
Fedik - comment - 12 Oct 2022

Please test the fix #38948

Add a Comment

Login with GitHub to post a comment