Search
Other ReReplacer questions
Forum

Broken page after Joomla 4 upgrade

Brady McCain's Avatar Brady McCain
I just upgraded a site to Joomla 4 on PHP 8.1. All extensions were up-to-date before the process started. I'm now getting an error message on a page that relies heavily on ReReplacer that says "RegularLabs\Library\RegEx::replace(): Return value must be of type string, null returned". Since I didn't change anything on the page, I wasn't sure why I was getting this error.

Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
I cannot access the frontend. It keeps saying my account is pending approval. And I get an email (after changing it to mine) without an activation url.
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
Also, can you give me (s)ftp access so I can take a deeper look?
Please post a rating at the Joomla! Extensions Directory
Brady McCain's Avatar Brady McCain
I added you as a temp super user through Akeeba AdminTools. Apparently, Community Builder didn't sync causing the login issue. I created a new user for you and tested it this time to make sure it worked. Sorry about that! Login and FTP credentials below...

Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
It looks like this is due to php memory limits (for Regular Expressions) on your server.
You have a LOT of content inside the {source} tags, which the Sourcerer needs to grab (via Regular Expressions).

I recommend you make the content part smaller and/or increase the php memory limit in the server settings for php.

Some tips for decreasing the amount of content:

You are placing a lot of inline CSS and Javascript.
Place these in separate .cc an .js files and load them in as explained here:
docs4.regularlabs.com/sourcerer/the-basi...tyles-and-javascript

Split very long parts of content you want Sourcerer to control in shorter parts. So using multiple {source} blocks.

Also, the majority of the content seems to be pretty standard html. Why use Sourcerer to output that at all? You could just place that in the html view of the editor.

Only surround the parts of the content with {source} tags for which you actually need Sourcerer.
Please post a rating at the Joomla! Extensions Directory
Brady McCain's Avatar Brady McCain
Thanks for your insight. I minimized the {source} tags to only encapsulate code where it was needed. I also moved CSS and JS to external files and use the linked method to add to my page. This has removed the initial error, but that has created an ordering problem (I think). I get a jQuery error (not defined) on the page. When I look at the page source, I see my linked script at the top of all the scripts, and jQuery (handled by jQuery Easy Profiles) is loaded several below it. Also the Email Protector is mishandling the email link outputs (look for an envelope icon).

The reason I decided to use ReReplacer for all of this was because this was a massive copy/paste project and I wanted to remove as much clutter from the page as possible. My plan for the future is to take all of that data, store it in the database, and just use a loop to output everything.
Peter van Westen's Avatar Peter van Westen ADMIN
The jQuery error has nothing to do with Sourcerer (or ReReplacer).
Sourcerer doesn't control how or if scripts work. It just makes sure they are placed/loaded.

The Email Protector issue is probably due to the the system plugin ordering. Try changing the ordering of the plugins in question.
See: regularlabs.com/blog/242-plugin-order-is-important
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription