No Code Attached Yet
avatar BrainforgeUK
BrainforgeUK
30 Nov 2023

Steps to reproduce the issue

Have a language .ini file with the following string.

PLG_ACCESSMESSAGE="This location must be accessible to PHP.<br/>
Your <i>open_basedir</i> configuration in <i>php.ini</i> may restrict this."

Expected result

Language file parsed OK.

Actual result

Language file parsed OK in 4.4.0 but not in 4.4.1

Remove the new lineline in the text and language file now parses.

PLG_ACCESSMESSAGE="This location must be accessible to PHP.<br/>Your <i>open_basedir</i> configuration in <i>php.ini</i> may restrict this."

System information (as much as possible)

Additional comments

libraries/src/Language/LanguageHelper.php
Why has INI_SCANNER_RAW been added to parse_ini_file / parse_ini_string on lines 423, 425?

@parse_ini_file($fileName, false, INI_SCANNER_RAW);

Works in most cases, but got a couple of extensions where it fails to parse the language file.

Example parses OK
PLG_ACCESSMESSAGE="This location must be accessible to PHP.<br/>Your <i>open_basedir</i> configuration in <i>php.ini</i> may restrict this."

Exampe does not parse
PLG_ACCESSMESSAGE="This location must be accessible to PHP.<br/>
Your <i>open_basedir configuration in <i>php.ini may restrict this."

avatar BrainforgeUK BrainforgeUK - open - 30 Nov 2023
avatar joomla-cms-bot joomla-cms-bot - change - 30 Nov 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Nov 2023
avatar BrainforgeUK
BrainforgeUK - comment - 30 Nov 2023

Found this information on parse_ini_file() function...

**The INI_SCANNER_NORMAL default option allows multiline values enclosed between quotes.

If you want to use the INI_SCANNER_RAW option, you must remove newlines in values.**

Well, could do that but makes maintaining a large .ini more difficult!

Why do we need INI_SCANNER_RAW?
Can we go back to INI_SCANNER_NORMAL for 4.4.2?

Maybe do that for 4.4.2 as a quick fix and for the longer term keep INI_SCANNER_RAW but get the file contents first and remove those newlines (with clever preg_replace) before calling parse_ini_string?

I assume the same issue applies to v5, but I have not checked.

==========================

See
php/php-src#11709

avatar bembelimen bembelimen - change - 30 Nov 2023
Title
Language .ini file not parsing in v4.4.1 - worked OK in v.4.4.0
[4.4.1] Language .ini file not parsing in v4.4.1 - worked OK in v.4.4.0
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-11-30 11:15:54
Closed_By bembelimen
avatar bembelimen bembelimen - close - 30 Nov 2023
avatar bembelimen
bembelimen - comment - 30 Nov 2023

Please see #42416.

Add a Comment

Login with GitHub to post a comment