Feature No Code Attached Yet
avatar dryabov
dryabov
4 Dec 2023

This feature request is inspired by the recent attempt to switch to the "raw" parser in Joomla 4.4.1/5.0.1.

Overview:

The proposal suggests a modification to the language file parser in Joomla from the current "normal" mode to the more efficient and secure "raw" mode of parse_ini_string for the Joomla 6.0 release. This change aims to improve performance while ensuring a more secure environment by eliminating string interpolation.

Proposal Details:

Parser Optimization: Switching to the "raw" parser mode provides significant performance advantages (parsing is ~30% faster). This mode specifically disallows string interpolation, thereby fortifying the platform against potential security vulnerabilities.

Backward Compatibility: To ensure a smooth transition and maintain backwards compatibility, the proposal suggests introducing a format="6.0" attribute within the languages and language nodes of an extension's XML manifest file. This addition will signal the use of the new "raw" format. In addition, legacy language files are automatically converted to the raw format during installation.

Example of a new format language block in the XML manifest:

<languages format="6.0" folder="language">
	<language tag="en-GB">en-GB/com_name.ini</language>
	<language tag="en-GB">en-GB/com_name.sys.ini</language>
</languages>

Also, the 5.x->6.0 upgrade script should iterate all installed extensions and convert their language files to the new format.

Differences between normal and raw parsers:

  1. String merging:
    • Normal: COM_A="text1" "text2"
    • Raw: not supported
  2. Multi-line strings:
    • Normal:
    COM_A="text1
    text2"
    
    • Raw: not supported
  3. Escaping
    • Normal (the following characters should be escaped: ", \, $): COM_A="<a href=\"link\"> \$ C:\\Windows\\"
    • Raw (no escaping): COM_A="<a href="link"> $ C:\Windows\"
  4. Single-quoted strings
    • Normal: COM_A='text'
    • Raw: not supported
  5. Processing of mixed comments/quotes in COM_A="AAA" ;"test"
    • Normal value: AAA
    • Raw value: AAA" ;"test

Expected Outcomes:

Performance Improvement: By using the faster "raw" mode, Joomla's language file parsing can achieve a significant performance boost, resulting in faster load times and an overall improved user experience.

Security: Eliminating string interpolation ensures a more secure environment by mitigating potential risks.

Request for Discussion:

This feature request is intended to initiate a constructive discussion within the Joomla community regarding the proposed parser change. Feedback, insights, and potential considerations from developers, contributors, and stakeholders are highly encouraged to collectively assess the feasibility, implications, and implementation strategies for this enhancement.

avatar dryabov dryabov - open - 4 Dec 2023
avatar joomla-cms-bot joomla-cms-bot - change - 4 Dec 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Dec 2023
avatar alikon alikon - change - 25 Dec 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-12-25 07:35:17
Closed_By alikon
avatar alikon alikon - close - 25 Dec 2023
avatar alikon
alikon - comment - 25 Dec 2023

please test #42463

avatar dryabov
dryabov - comment - 25 Dec 2023

Actually, I created this topic with the assumption that my patch #42463 will be accepted, but there is no direct connection between these two discussions.

Here I want to discuss how to change the format of language files in Joomla 6.0 (normal->raw), how to minimize possible problems while maintaining backward compatibility as much as possible, etc.

So, in my opinion, it's too early to close this discussion.

avatar alikon alikon - change - 27 Dec 2023
Labels Added: Feature
avatar alikon alikon - labeled - 27 Dec 2023
avatar alikon alikon - change - 27 Dec 2023
Status Closed New
Closed_Date 2023-12-25 07:35:17
Closed_By alikon
avatar alikon alikon - reopen - 27 Dec 2023
avatar bembelimen bembelimen - close - 3 Jan 2024
avatar bembelimen
bembelimen - comment - 3 Jan 2024

I will close it, reason is here: #42463 (comment)

avatar bembelimen bembelimen - change - 3 Jan 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-01-03 19:25:11
Closed_By bembelimen

Add a Comment

Login with GitHub to post a comment