User tests: Successful: Unsuccessful:
…yle declarations being used that mean that we have an array of scripts or stylesheets to be cached and not just a string
Cache setWorkarounds returns an array not a string
Pull Request for Issue # .
Correct Joomla\CMS\Cache Cache setWorkarounds to take account of multiple script or style declarations being used that mean that we have an array of scripts or stylesheets to be cached and not just a string
Joomla\CMS\Cache Cache setWorkarounds returns an array not a string
At Step 6 you get a php warning on arguments to mb_strlen and 4 javascript alert messages
See https://www.yoursites.net/testextensions/Screenshot%202021-11-17%20at%2010-05-05%20Home.png
At step 7 you get a different PHP warning from libraries/src/Document/HtmlDocument.php because it expects an array but has been given a script by Cache.php
Page is displayed with no warning messages and module content is delivered from the cache correctly with 4 alerts
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
@brianteeman Its the same problem the cache code is applying strlen to an array.
I had error reporting enabled but not joomla debug mode when I was testing
I enabled debug because you had it enabled in your screenshot ;)
With or without the debug I get the error page and not what you described
If you look at the screenshot of your debug trace notice that line 4 in the stack refers to line 694 of the file Cache.php - this is exactly where I am saying the error arises. If you are still seeing a reference to strlen error on line 694 of Cache.php then you I suspect you are seeing a cached version of the error output since line 694 no longer has a call to StringHelper::strlen in my version of the code.
If you apply the fix and clear the cache and repeat the test the error you are seeing should not appear.
I have tested this item
Tested Successfully, pre-patch clearly shows the error
Warning
: mb_substr() expects parameter 1 to be string, array given in
/var/www/joomla4/libraries/vendor/joomla/string/src/phputf8/mbstring/core.php
on line
On applying patch without clearing cache we get:
Warning
: Invalid argument supplied for foreach() in
/var/www/joomla4/libraries/src/Document/HtmlDocument.php
on line
389
Clearing cache with path applied it loads without error.
Thanks @tonypartridge - forgot to emphasise that after applying the fix it is ESSENTIAL to clear the cache.
The error in HtmlDocument.php that you saw is a secondary manifestation of the same problem - Cache.php is storing the the cached data as a string but HtmlDocument.php is expecting it to be an array. My change resolves this issue (as you discovered)
@Fedik Would you mind taking a look at this issue and PR please - your PR ( in https://github.com/joomla/joomla-cms/commit/86a0d88e415112553ede15e989cfa1b81a32e15c) stored the scripts and styles as arrays but these changes should have been carried over to the Cache system too. This PR resolves these issues.
Thanks
From code review it looks good,
I try to test a bit later
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
r
t
c
I have tested this item
I have tested this item
Labels |
Added:
?
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-01-05 12:37:57 |
Closed_By | ⇒ | wilsonge |
Thanks!
@brianteeman would you have a minute some time to test?
I'll do one tomorrow.