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

[4.4.1] Language .ini file not parsing in v4.4.1 - worked OK in v.4.4.0 #42432

Closed
BrainforgeUK opened this issue Nov 30, 2023 · 2 comments
Closed

Comments

@BrainforgeUK
Copy link
Contributor

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."

@BrainforgeUK BrainforgeUK changed the 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 Nov 30, 2023
@BrainforgeUK
Copy link
Contributor Author

BrainforgeUK commented Nov 30, 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

@bembelimen
Copy link
Contributor

Please see #42416.

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

3 participants