Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php8 issue mb_strlen() #35744

Closed
RedDustSnow opened this issue Oct 4, 2021 · 12 comments
Closed

php8 issue mb_strlen() #35744

RedDustSnow opened this issue Oct 4, 2021 · 12 comments

Comments

@RedDustSnow
Copy link

RedDustSnow commented Oct 4, 2021

Steps to reproduce the issue

Migrated my site to J4.03 successfully.
Once up, Changed PHP from 7.4 to php8

Expected result

The site would run as expected, without error.

Actual result

Got a fatal error on the frontend on certain pages (eg https://reddustsnow.com.au/outback-nsw-touring-watershed-loop.html)

File: ../libraries/vendor/joomla/string/src/phputf8/mbstring/core.php
Line: 24
Error: mb_strlen(): Argument #1 ($string) must be of type string, array given

System information (as much as possible)

Joomla! 4.0.3 Stable
Web Server: LiteSpeed

Additional comments

DEBUG STACK:

Function Location

1 () JROOT/libraries/vendor/joomla/string/src/phputf8/mbstring/core.php:24
2 mb_strlen() JROOT/libraries/vendor/joomla/string/src/phputf8/mbstring/core.php:24
3 utf8_strlen() JROOT/libraries/vendor/joomla/string/src/StringHelper.php:262
4 Joomla\String\StringHelper::strlen() JROOT/libraries/src/Cache/Cache.php:694
5 Joomla\CMS\Cache\Cache::setWorkarounds() JROOT/libraries/src/Cache/Controller/CallbackController.php:131
6 Joomla\CMS\Cache\Controller\CallbackController->get() JROOT/libraries/src/Helper/ModuleHelper.php:670
7 Joomla\CMS\Helper\ModuleHelper::moduleCache() JROOT/libraries/src/Document/Renderer/Html/ModuleRenderer.php:96
8 Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render() JROOT/plugins/content/loadmodule/loadmodule.php:179
9 PlgContentLoadmodule->_load() JROOT/plugins/content/loadmodule/loadmodule.php:85
10 PlgContentLoadmodule->onContentPrepare() JROOT/libraries/src/Plugin/CMSPlugin.php:285
11 Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin{closure}() JROOT/libraries/vendor/joomla/event/src/Dispatcher.php:486
12 Joomla\Event\Dispatcher->dispatch() JROOT/libraries/src/Application/EventAware.php:111
13 Joomla\CMS\Application\WebApplication->triggerEvent() JROOT/components/com_content/src/View/Article/HtmlView.php:240
14 Joomla\Component\Content\Site\View\Article\HtmlView->display() JROOT/libraries/src/Cache/Controller/ViewController.php:102
15 Joomla\CMS\Cache\Controller\ViewController->get() JROOT/libraries/src/MVC/Controller/BaseController.php:683
16 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/components/com_content/src/Controller/DisplayController.php:125
17 Joomla\Component\Content\Site\Controller\DisplayController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:730
18 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:146
19 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT/components/com_content/src/Dispatcher/Dispatcher.php:55
20 Joomla\Component\Content\Site\Dispatcher\Dispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:389
21 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:206
22 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:245
23 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:278
24 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:63
25 require_once() JROOT/index.php:32

Note {closure} in #11... Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin{closure}()

Joomla forum told me it is a core issue.
First time I have done this so hoping all there. Please note this is a live (production) site it is currently running php7.4

Regards
Simon B

@carlitorweb
Copy link
Member

carlitorweb commented Oct 4, 2021

Following the link: https://reddustsnow.com.au/outback-nsw-touring-watershed-loop.html did not thrown any error.

Also, is 4.02 or 4.0.3?

@RedDustSnow
Copy link
Author

RedDustSnow commented Oct 4, 2021

Hi carlitorweb, no it won't as it is my production site, so had to revert to php7.4. Creates a fatal error.

J4.03 . Sorry for confusion


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35744.

@RedDustSnow
Copy link
Author

Hi guys, I thought I might have seen some update on the reported issue with the release of 4.0.4. Non listed.

So I thought I would update and try with 4.0.4 to see if any of the updates inadvertently fixed the issue.

It didn't.
error-cache-on

BUT, I discovered that it is related to the system cache. If the cache is off, the page/s display without the mentioned error.
page-cache-off

  • Browser cache was cleared *

Any clues?

Regards

Simon

@brianteeman
Copy link
Contributor

I am guessing that the problem is occurring on pages where you have loaded a module in the content item?

If that guess is correct what module is it and what are the contents of that module

@RedDustSnow
Copy link
Author

Hi Brian, thanks for your reply.

Yes, there are several modules, custom content modules. Each contains an image, some text, but also a link to a banner in the form <a href="component/banners/click/39.html....

Could that be the issue?

@brianteeman
Copy link
Contributor

I dont know but the more information the better to try and find the problem

@RedDustSnow
Copy link
Author

Ok, also running sliders/tabs on that page.

When the problem presents, it is across most, but not all of the (Joomla) content; those custom modules are probably across a similar amount of pages.
I will strip down the mentioned page and do some testing. I will need to do it in the morning AUS time, As it is a production site.

Gives me something to work with though. I will check back tomorrow.

@RedDustSnow
Copy link
Author

Ok, found it.

It was the OS Download link at the bottom of the page.

But, why would it only creates the issue when the system cache is on.

Simon
PS, a relief to discover the conflict as php8 was the main reason I went to J4 early (Love it by the way!)

@brianteeman
Copy link
Contributor

Sorry I don't know the code in os downloads so you will do best speaking to the developers. Glad you found the source

@RedDustSnow
Copy link
Author

A bit more...

If I put the link to the download (that is in the custom module) directly in the article, it works fine.
BUT... if I put that same code into a new custom module... the error happens.

So it appears to be a conflict between the custom module and the download button {osdownloads download_button 04 "Download"}, when the page is built.

I will let them know.

@RedDustSnow
Copy link
Author

PS... thanks for helping me pinpoint the issue @brianteeman, appreciated!

@chmst
Copy link
Contributor

chmst commented Oct 28, 2021

Then I close this issue for now. Thanks @ALL for help and feedback.

@chmst chmst closed this as completed Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants