? ? ? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
27 Apr 2017

closes #15587

Use sensible code to process ini files when moronic web hosts disable parse_ini_file in php.ini

Please test

avatar PhilETaylor PhilETaylor - open - 27 Apr 2017
avatar PhilETaylor PhilETaylor - change - 27 Apr 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Apr 2017
Category Libraries
avatar dgt41
dgt41 - comment - 27 Apr 2017

@PhilETaylor shouldn't this be conditional, if php_ini_parse not exist then use FOF?

avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

FOF does that check!

public static function parse_ini_file($file, $process_sections, $rawdata = false)

avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

I know Travis is unhappy, will look at that in a moment, but this fix fixes the brokenness

avatar dgt41
dgt41 - comment - 27 Apr 2017

Still, this will be faster (one less file, less memory for the good hosts):

		$isMoronHostFile = !function_exists('parse_ini_file');

		if ($isMoronHostFile)
		{
         		$strings = FOFUtilsIniParser::parse_ini_file($filename, true);
		}
		else
		{
			$strings = @parse_ini_file($filename);
		}
avatar PhilETaylor PhilETaylor - change - 27 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 27 Apr 2017
Category Libraries Libraries Unit Tests
avatar PhilETaylor PhilETaylor - change - 27 Apr 2017
Labels Added: ?
73785e9 27 Apr 2017 avatar PhilETaylor TABS!
avatar zero-24
zero-24 - comment - 27 Apr 2017

Should we really create another dependencey to FOF where we try to remove it at other places?

avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

Unless you want to write your own pure PHP implementation of parse_ini_file quickly to resolve the issue...

FOFUtilsIniParser is nothing but a wrapper to parse_ini_file_php

There is no point in pulling parse_ini_file_php out into another file, and duplicating code in the core...

avatar Bakual
Bakual - comment - 27 Apr 2017

Using FOF certainly isn't right.

avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

Well it works. If someone cares to lay out exactly what "fix" they would prefer to merge, it can be coded...

I was not involved with the breaking change, I was just fed up with 60+ comments of people saying "it doesnt work" in #15587 so I looked, and within seconds found a solution...

How you want that solution cemented into the core, well it appears anyway but the ways I chose..

avatar zero-24
zero-24 - comment - 27 Apr 2017

@PhilETaylor

remove QQ replacement (apparently its not needed)

why do you think so?

parse_ini_file can do that: http://php.net/manual/en/function.parse-ini-file.php

Constants may also be parsed in the ini file so if you define a constant as an ini value before running parse_ini_file(), it will be integrated into the results.

But i can not find something like that for parse_ini_string: http://php.net/manual/en/function.parse-ini-string.php

I have not tested this yet but maybe you have..

avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

why do you think so?

Cause "he said so" :-) #15620 (comment)

I can put it back?

avatar zero-24
zero-24 - comment - 27 Apr 2017

As i have said i have not checked it yet and i have not saw that comment above. Needs to be tested.

avatar Bakual
Bakual - comment - 27 Apr 2017

Honestly, just revert #13407.

avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

I think pretty much that is where I have got to :)

avatar zero-24
zero-24 - comment - 27 Apr 2017

@Bakual i think the rest (array + renaming a var) can stay from that PR? Just that str_replace needs to be checked i guess.

avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

@mbabker if we are removing the requirement for Joomla to have parse_ini_file enabled, then we can remove this check too ? https://github.com/joomla/joomla-cms/pull/15619/files

avatar brianteeman
brianteeman - comment - 27 Apr 2017

You absolutely can not remove the qq processing!!

avatar mbabker
mbabker - comment - 27 Apr 2017

Do not revert #13407

The only thing you need to do is basically if parse_ini_file is usable then use it otherwise use our old way which supports broken INI files

  1. We need to stop allowing broken crap to work in our core APIs
  2. The simplest option is to use the simplest function if available, since apparently hosts are 3 steps past moronic we can have a sensible fallback (i.e. the old code which has been proven to work with broken files)
  3. The fact that this project is still so reluctant to accept valid third party solutions is really getting out of hand. We don't have the developers to write everything ourselves because we keep chasing everyone with half an ounce of skill away.
avatar PhilETaylor PhilETaylor - change - 27 Apr 2017
The description was changed
avatar PhilETaylor PhilETaylor - edited - 27 Apr 2017
avatar infograf768
infograf768 - comment - 27 Apr 2017

I have tested this item successfully on dc00875


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

avatar infograf768 infograf768 - test_item - 27 Apr 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 27 Apr 2017

For testers:
add
disable_functions = parse_ini_file
on your php.ini file
Stop and restart server.

avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

Stop and restart server.

Or your php-fpm process, depending on how you are running PHP :)

avatar csthomas
csthomas - comment - 27 Apr 2017

Constants for parse_ini_string() are supported in php version 5.3.2.
I have checked it at https://3v4l.org/#preview

Constants are not supported in hhvm 3.19.1 and lower at all for both (parse_ini_file, parse_ini_string)

I tested with code:

echo phpversion() . "\n";
define('__QQ__', " WORKS ");
print_r(parse_ini_string('A="IT"__QQ__"GREATE!"'));
print_r(parse_ini_file(__DIR__ . '/test.ini'));

For hhvm I got:

5.6.99-hhvm
Array
(
    [A] => IT__QQ__GREATE!
)
Array
(
    [A] => IT__QQ__GREATE!
)
avatar PhilETaylor
PhilETaylor - comment - 27 Apr 2017

Does Joomla officially support HHVM ? (https://downloads.joomla.org/technical-requirements)

avatar csthomas
csthomas - comment - 27 Apr 2017

If you will add unittest for __QQ__ then you will have to:)

avatar Bakual
Bakual - comment - 27 Apr 2017

Afaik currently unit tests run on HHVM. But the CMS itself not necessary. To my knowledge we don't support it yet officially.

avatar rdeutz
rdeutz - comment - 2 May 2017

Can some test this so that we can get this in 3.7.1?

avatar PhilETaylor
PhilETaylor - comment - 2 May 2017

Can some test this so that we can get this in 3.7.1?

Please everyone test.

avatar infograf768
infograf768 - comment - 2 May 2017

I have tested this item successfully on 30e69b3


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

avatar infograf768 infograf768 - test_item - 2 May 2017 - Tested successfully
avatar AlexRed
AlexRed - comment - 2 May 2017

I have tested this item successfully on 30e69b3

Patch ok for me


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

avatar AlexRed AlexRed - test_item - 2 May 2017 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 May 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 May 2017

RTC after two successful tests.

avatar rdeutz rdeutz - change - 3 May 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-05-03 06:27:19
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 3 May 2017
avatar rdeutz rdeutz - merge - 3 May 2017
avatar MixingOnBeat
MixingOnBeat - comment - 12 May 2017

Boy, did I also have a rough time with this update from 3.6.5 to 3.7.0. After the upgrade all the text in the admin panel as well as some text on the public pages were a mess. I also have a host/server that doesn't allow me to alter php.ini files. :(

I had to revert back my changes (glad I made a backup of the files/database). I hope you guys find a common ground for 3.7.1. I read all arguments and though it would be nice that some hosts would not do this, but as long this can be fixed using a bit of code, perhaps this is best for everyone.

avatar wilsonge
wilsonge - comment - 12 May 2017

This patch got merged and we hope that 3.7.1 will drop towards the end of next week with the fix for you in :)

avatar hakanara
hakanara - comment - 1 Jun 2017

Hi all, this issue is still existing with a fresh 3.7.2 installation. Shall I open a new issue?

avatar brianteeman
brianteeman - comment - 1 Jun 2017

Yes please

avatar hakanara
hakanara - comment - 21 Jul 2017

Fresh installation or a 3.7.3 upgrade still shows us that moronic hosting issue interferes Joomla and prevents Joomla from rocking. All Joomla loverz, let's unite and let Joomla rock!

avatar hakanara
hakanara - comment - 21 Jul 2017

You are all invited to the reopening of #17198

Add a Comment

Login with GitHub to post a comment