Language Change bug PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar AbhishekDas
AbhishekDas
3 Sep 2025

Summary of Changes

Currently, when the "System - Page Cache" plugin is published, the form token input field is also cached. As a result, users cannot log in using the login module or any similar modules. Additionally, the login page does not function correctly unless it is excluded from caching. I have added a new option in the plugin settings called "Refresh Form Token." When this option is enabled, the form token input fields are automatically refreshed on all cached pages. Since this option is disabled by default, it maintains backward compatibility.

Testing Instructions

  1. Place the login module anywhere on the site.
  2. Publish the "System - Page Cache" plugin.
  3. After the session lifetime expires, refresh the page and attempt to log in using the login module or from the login page.

Actual Result BEFORE Applying This Pull Request

The login process fails with a message stating that the token has expired.

Expected Result AFTER Applying This Pull Request

  1. Enable the "Refresh Form Token" option in the plugin settings.
  2. The login process should work without issues.
avatar AbhishekDas AbhishekDas - open - 3 Sep 2025
avatar AbhishekDas AbhishekDas - change - 3 Sep 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Sep 2025
Category Administration Language & Strings Front End Plugins
avatar richard67 richard67 - change - 3 Sep 2025
Title
Fixed CRSF form token caching by the page cache plugin
[5.3] Fixed CRSF form token caching by the page cache plugin
avatar richard67 richard67 - edited - 3 Sep 2025
avatar richard67
richard67 - comment - 3 Sep 2025

Hmm, to me that looks like a new feature as it adds a new configuration option to the plugin.

New features would have to go into 6.1-dev.

avatar AbhishekDas
AbhishekDas - comment - 3 Sep 2025

Hmm, to me that looks like a new feature as it adds a new configuration option to the plugin.

New features would have to go into 6.1-dev.

I could apply the fix without the additional configuration option. But I did not see any harm in adding that option.

People are unable to use the login module when the page cache plugin is enabled. So we need to fix it as soon as possible.

Would you also like me to create separate pull requests to 5.4-dev and 6.1-dev?

avatar richard67
richard67 - comment - 3 Sep 2025

I could apply the fix without the additional configuration option. But I did not see any harm in adding that option.

@AbhishekDas Is does not matter if it does harm or not. We follow Semantic Versioning https://semver.org/ .

A new configuration option normally counts as a new feature.

Would you also like me to create separate pull requests to 5.4-dev and 6.1-dev?

No, it does not make sense to create 3 separate pull requests. But the one pull request has to be created for the right branch.

5.4 and 6.0 had already feature freeze, so new features go into 6.1 and nowhere else.

We will discuss it in the CMS Maintainers team and come back to you here with the result.

Depending on that, you or we might have to rebase your branch for this PR.

avatar AbhishekDas
AbhishekDas - comment - 3 Sep 2025

@richard67 Ok. I thought it was a bug fix.

I'll wait for your update.

avatar brianteeman
brianteeman - comment - 3 Sep 2025

realistically the page cache plugin should not be used for a site requiring login. its only intended for very static sites

avatar SniperSister
SniperSister - comment - 3 Sep 2025

There is existing code in the CMS addressing the exact scenario mentioned in this PR:

if (isset($data['body'])) {
$token = Session::getFormToken();
$search = '#<input type="hidden" name="[0-9a-f]{32}" value="1">#';
$replacement = '<input type="hidden" name="' . $token . '" value="1">';
$data['body'] = preg_replace($search, $replacement, $data['body']);
$body = $data['body'];
}

avatar SniperSister SniperSister - test_item - 3 Sep 2025 - Tested unsuccessfully
avatar SniperSister
SniperSister - comment - 3 Sep 2025

I have tested this item 🔴 unsuccessfully on 1814726

I'm unable to reproduce the described issue.


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

avatar AbhishekDas
AbhishekDas - comment - 3 Sep 2025

realistically the page cache plugin should not be used for a site requiring login. its only intended for very static sites

@brianteeman Yes, I also used to say the same thing to everyone until we added the "Exclude Menu Items" and "Exclude URLs" options to the plugin. But now they use it on all sites, including very dynamic ecommerce websites. So, they also want the login module to function correctly.

avatar brianteeman
brianteeman - comment - 3 Sep 2025

Did you check if the performance was improved. On good hosting I never saw any measurable performance

avatar AbhishekDas AbhishekDas - change - 3 Sep 2025
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2025-09-03 19:30:52
Closed_By AbhishekDas
Labels Added: Language Change bug PR-5.3-dev
avatar AbhishekDas AbhishekDas - close - 3 Sep 2025
avatar AbhishekDas
AbhishekDas - comment - 3 Sep 2025

There is existing code in the CMS addressing the exact scenario mentioned in this PR:

if (isset($data['body'])) {
$token = Session::getFormToken();
$search = '#<input type="hidden" name="[0-9a-f]{32}" value="1">#';
$replacement = '<input type="hidden" name="' . $token . '" value="1">';
$data['body'] = preg_replace($search, $replacement, $data['body']);
$body = $data['body'];
}

@SniperSister Yes, that indeed does the job. It seems the customer was on an older version. I am closing this PR.

avatar AbhishekDas
AbhishekDas - comment - 3 Sep 2025

Did you check if the performance was improved. On good hosting I never saw any measurable performance

Yes, it does help a few sites that run query-heavy extensions and are hosted on shared servers.

Add a Comment

Login with GitHub to post a comment