?
Duplicate of # 15587
avatar hakanara
hakanara
20 Jul 2017

I am very sorry to report this issue because it is an exact duplicate of #15587

I have waited for 3 upgrades and a few weeks for this issue to be resolved, the contributors made some efforts to solve it so far but indeed nothing has changed for me on my server. I need my hosting company to enable the parse_ini_file function and the site looks normal then. But what about a Joomla beginner? I know the solution and contact my hosting company, which is one of the biggest in Turkey, to make some changes on the server settings. Don't we still have a more stable solution for this ini file parsing issue?

Steps to reproduce the issue

Upgrade from 3.6 to 3.7.3

Expected result

All the backend and frontend language strings to appear as defined in language files

Actual result

None of the strings are parsed and they look like the screenshot below:
joomla

System information (as much as possible)

COM_ADMIN_SETTING | COM_ADMIN_VALUE
COM_ADMIN_PHP_BUILT_ON |  
COM_ADMIN_DATABASE_VERSION | 5.6.36-cll-lve
COM_ADMIN_DATABASE_COLLATION | latin1_swedish_ci
COM_ADMIN_DATABASE_CONNECTION_COLLATION | utf8mb4_general_ci
COM_ADMIN_PHP_VERSION | 5.6.31
COM_ADMIN_WEB_SERVER | LiteSpeed
COM_ADMIN_WEBSERVER_TO_PHP_INTERFACE | litespeed
COM_ADMIN_JOOMLA_VERSION | Joomla! 3.7.3 Stable [ Amani ] 4-July-2017 08:03 GMT
COM_ADMIN_PLATFORM_VERSION | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
COM_ADMIN_USER_AGENT | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0

Additional comments

Please find a stable solution for this issue without having me contacting the hosting company after upgrading each site.

avatar hakanara hakanara - open - 20 Jul 2017
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jul 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Jul 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 21 Jul 2017
Category com_joomlaupdate Language & Strings
avatar franz-wohlkoenig franz-wohlkoenig - change - 21 Jul 2017
Rel_Number 0 15587
Relation Type Duplicate of
avatar Bakual
Bakual - comment - 21 Jul 2017

Actually. enabling parse_ini_files is the best way anyway.

@PhilETaylor Since #15620 was supposed to fix this on those less-than-optimal-hosts, do you have a clue why it could still fail?

avatar wilsonge
wilsonge - comment - 21 Jul 2017

After that PR we should call back to the old way of doing things (pre 3.7.0) when the function isn't enabled. So we need to figure out exactly what's changed for you.

avatar wojsmol
wojsmol - comment - 21 Jul 2017

I had a similar problem in my plugins - resolved by replacing _QQ_ with \ ". See backbutton/content-plugin#9

avatar hakanara hakanara - change - 21 Jul 2017
The description was changed
avatar hakanara hakanara - edited - 21 Jul 2017
avatar hakanara hakanara - change - 21 Jul 2017
The description was changed
avatar hakanara hakanara - edited - 21 Jul 2017
avatar zero-24
zero-24 - comment - 21 Jul 2017

Please run and show us the result. Thanks

<?php
if (function_exists('parse_ini_file'))
{
	echo 'parse_ini_file';
}
else
{
	echo 'parse_ini_string';
}

echo '<br>';
echo 'The current PHP Version is ' . phpversion();
avatar hakanara
hakanara - comment - 21 Jul 2017

parse_ini_file
The current PHP Version is 5.6.31

avatar hakanara
hakanara - comment - 21 Jul 2017

I can change the PHP version from cpanel and test with different php versions if necessary?

avatar zero-24
zero-24 - comment - 21 Jul 2017

hmm this mean the php feature is implemented but failing.. Can you reproduce this using a core only install on the same webserver?

avatar hakanara
hakanara - comment - 21 Jul 2017

@zero-24 thank you very much for your support. I have done it recently and it was a fresh installation and it was like this again. I will do it right now once again and inform you about the issue. I will test it with different php versions as well.

avatar hakanara
hakanara - comment - 21 Jul 2017

Fresh installation, first moment of truth:
joomla2

avatar hakanara
hakanara - comment - 21 Jul 2017

Aha! Second moment of truth: With PHP version 7.1. Surprise:
joomla3

avatar hakanara
hakanara - comment - 21 Jul 2017

It is good with PHP 7.0 as well. Good to know. But still, it would be nice to publish a fix for lower PHP versions.

avatar zero-24
zero-24 - comment - 21 Jul 2017

I did have just tested 5.5.38 & 5.6.30 and I can not reproduce the issue. Can you please double check the results of the script above per PHP Version?

Please also try the following changes...
https://github.com/joomla/joomla-cms/compare/staging...zero-24:parseinifile?expand=1
... and tell me if that helps.

avatar hakanara
hakanara - comment - 21 Jul 2017

parse_ini_string
The current PHP Version is 5.2.17

parse_ini_string
The current PHP Version is 5.3.29

parse_ini_string
The current PHP Version is 5.4.45

parse_ini_string
The current PHP Version is 5.5.38

parse_ini_file
The current PHP Version is 5.6.31 (I think this was default on server)

parse_ini_string
The current PHP Version is 7.0.21

parse_ini_string
The current PHP Version is 7.1.7

So how is this possible @zero-24 ?

avatar zero-24
zero-24 - comment - 21 Jul 2017

This depends on your server setup. Please check the patch i have linked above.

avatar Bakual
Bakual - comment - 21 Jul 2017

What language is that? It may be an error in the language pack?

avatar brianteeman
brianteeman - comment - 21 Jul 2017

Turkish

avatar zero-24
zero-24 - comment - 21 Jul 2017

Even if it would be a broken language. The fallback should be parse_ini_string ;)

avatar hakanara
hakanara - comment - 21 Jul 2017

I will check the patch in the morning because the hosting company changed the current settings and left because of their working hours. I will have those changes reverted tomorrow.

In the meanwhile, I would like to share this with you, that I have found in PHP manual:

A function name may exist even if the function itself is unusable due to configuration or compiling options (with the image functions being an example).

avatar hakanara
hakanara - comment - 21 Jul 2017

As far as I understand now, the function exists but is not allowed due to default server settings (PHP 5.6 is default). So Joomla sees that parse_ini_file exists but it is not allowed actually so it does not fall back to parse_ini_string.

avatar zero-24
zero-24 - comment - 21 Jul 2017

Sounds like that. So please check the patch i have provided above. Thanks.

avatar hakanara
hakanara - comment - 22 Jul 2017

Unfortunately the patch did not work. The issue is still the same as above. If the parse_ini_file function exists but not allowed, the language strings are not parsed. If the parse_ini_file function does not exist (as in the other versions except PHP 5.6 here) it works fine. I think it falls back to parse_ini_string then.

avatar hakanara
hakanara - comment - 22 Jul 2017

So what do you recommend in this case? I can talk with my hosting company and ask them to remove this function from default settings so that I don't suffer any more or the developers propose us another way something like this:

if (function_exists('parse_ini_file') && (function_enabled('parse_ini_file')){}

Of course, function_enabled is something I made up. :-)

avatar hakanara
hakanara - comment - 22 Jul 2017

So as a result, if I prefer to setup Joomla with PHP 7.0 and above, I don't have any problems. I can personally solve the problem. But I still believe that Joomla should modify the code so that when parse_ini_file exists but is not enabled the code should be able to work.

Very big thank you to all, who helped me to understand what was going on. Especially to @zero-24

avatar dgt41
dgt41 - comment - 22 Jul 2017

@hakanara how about a try catch for the function_enabled ?

avatar hakanara
hakanara - comment - 22 Jul 2017

Is there a significant page loading difference when parse_ini_file or parse_ini_string used when parsing the language strings are parsed? Which is better, can anybody tell me please?

avatar zero-24
zero-24 - comment - 22 Jul 2017

Please check with your hosting if they use the 'suhosin' extension to disable that function.

avatar wilsonge
wilsonge - comment - 23 Jul 2017
<?php
$disabled_functions = explode(',', ini_get('disable_functions'));
$is_parse_ini_file_enabled = !in_array('parse_ini_file', $disabled_functions);
if (function_exists('parse_ini_file') && $is_parse_ini_file_enabled) {
        echo 'parse_ini_file';
} else {
        echo 'parse_ini_string';
}

echo '<br>'; echo 'The current PHP Version is ' . phpversion();

What happens if you run this on the same hosts?

avatar zero-24
zero-24 - comment - 23 Jul 2017

I was asking for suhosin because of this: http://php.net/manual/de/function.function-exists.php#77980 as based on that comment

If you use suhosin.executor.func.blacklist instead of disabled_functions in your php.ini, function_exists will return true for a disabled function.

avatar hakanara
hakanara - comment - 24 Jul 2017

@wilsonge Did it work? If I run this script it says:

parse_ini_file
The current PHP Version is 5.6.31
avatar hakanara
hakanara - comment - 24 Jul 2017

And @zero-24 , the hosting company says that they do not use any extension to disable the function. They disable it via php.ini. This is the answer they gave me.

avatar franz-wohlkoenig franz-wohlkoenig - change - 25 Jul 2017
Status New Discussion
avatar hakanara
hakanara - comment - 26 Jul 2017

I updated my comment above. I think it didn't work. It still see parse_ini_file (and this function is not enabled) with the code @wilsonge sent me.

avatar zero-24
zero-24 - comment - 26 Jul 2017

They disable it via php.ini. This is the answer they gave me.

hmm. but this is exactly that what @wilsonge tested by manually checking ini_get('disable_functions') As well as function_exists should do this too.

avatar hakanara
hakanara - comment - 26 Jul 2017

Does it mean they have changed some settings in between the messages. This is possible because I also contacted the housing company after I opened the issue. Do you want me to retest something else?

avatar zero-24
zero-24 - comment - 26 Jul 2017

Hmm if possible can you share this issue with them and ask them to share the exact way how we should detect that the feature is disabled?

When I'm back to my PC tomorrow i can also build a script to test the suhosin extension just to be sure.

avatar zero-24
zero-24 - comment - 27 Jul 2017

So here is the script:


$func = 'parse_ini_file';

if (extension_loaded('suhosin'))
{
        $suhosin = @ini_get("suhosin.executor.func.blacklist");

        if (empty($suhosin) == false)
        {
            $suhosin = explode(',', $suhosin);
            $suhosin = array_map('trim', $suhosin);
            $suhosin = array_map('strtolower', $suhosin);
            $result = array_search($func, $suhosin);

            if ($result === false)
            {
                echo 'disabled by suhosin';
            }
        }
    }
}
else
{
echo 'suhosin is not installed';
}
echo '<br>';
echo phpversion();
avatar hakanara
hakanara - comment - 27 Jul 2017

Thank you very much. There was an extra bracket in the script, I removed it and then the code worked. The result is:
suhosin is not installed
7.1.7

The same for 5.6.31 as well.

So here is the translated answer of the hosting company about disabling the function:
You can diplay all the disabled functions via this link:
http://lcpr01.vargonen.net/info.php

These functions are disabled by writing "disable_functions=apache_child_terminate, apache_setenv, parse_ini_file" on php.ini file. There isn't any extensions or addons to disable these functions.

avatar wilsonge
wilsonge - comment - 27 Jul 2017
<?php
$disabled_functions = explode(',', ini_get('disable_functions'));
var_dump($disabled_functions);

So if you run this on your server what's the result?

avatar hakanara
hakanara - comment - 27 Jul 2017

array(84) { [0]=> string(22) "apache_child_terminate" [1]=> string(14) " apache_setenv" [2]=> string(24) " define_syslog_variables" [3]=> string(15) " escapeshellarg" [4]=> string(15) " escapeshellcmd" [5]=> string(5) " eval" [6]=> string(5) " exec" [7]=> string(3) " fp" [8]=> string(5) " fput" [9]=> string(9) " ftp_exec" [10]=> string(15) " highlight_file" [11]=> string(10) " ini_alter" [12]=> string(12) " ini_restore" [13]=> string(12) " inject_code" [14]=> string(8) " openlog" [15]=> string(9) " passthru" [16]=> string(10) " php_uname" [17]=> string(18) " phpAds_remoteInfo" [18]=> string(14) " phpAds_XmlRpc" [19]=> string(20) " phpAds_xmlrpcDecode" [20]=> string(20) " phpAds_xmlrpcEncode" [21]=> string(6) " popen" [22]=> string(11) " posix_kill" [23]=> string(13) " posix_mkfifo" [24]=> string(14) " posix_setpgid" [25]=> string(13) " posix_setsid" [26]=> string(13) " posix_setuid" [27]=> string(13) " posix_setuid" [28]=> string(12) " posix_uname" [29]=> string(11) " proc_close" [30]=> string(16) " proc_get_status" [31]=> string(10) " proc_nice" [32]=> string(10) " proc_open" [33]=> string(15) " proc_terminate" [34]=> string(11) " shell_exec" [35]=> string(7) " syslog" [36]=> string(7) " system" [37]=> string(21) " xmlrpc_entity_decode" [38]=> string(12) " show_source" [39]=> string(8) " symlink" [40]=> string(5) " mail" [41]=> string(8) " foreach" [42]=> string(12) " openbasedir" [43]=> string(7) " f_open" [44]=> string(3) " dl" [45]=> string(4) " cat" [46]=> string(15) " mysql_list_dbs" [47]=> string(17) " get_current_user" [48]=> string(9) " getmyuid" [49]=> string(9) " pconnect" [50]=> string(5) " link" [51]=> string(4) " fin" [52]=> string(13) " passthruexec" [53]=> string(9) " fileread" [54]=> string(11) " pcntl_exec" [55]=> string(15) " parse_ini_file" [56]=> string(5) " leak" [57]=> string(6) " chown" [58]=> string(16) " allow_url_fopen" [59]=> string(10) " fpassthru" [60]=> string(8) " execute" [61]=> string(6) " shell" [62]=> string(6) " chgrp" [63]=> string(14) " stream_select" [64]=> string(14) " socket_select" [65]=> string(14) " socket_create" [66]=> string(21) " socket_create_listen" [67]=> string(19) " socket_create_pair" [68]=> string(14) " socket_listen" [69]=> string(14) " socket_accept" [70]=> string(12) " socket_bind" [71]=> string(16) " socket_strerror" [72]=> string(11) " pcntl_fork" [73]=> string(13) " pcntl_signal" [74]=> string(14) " pcntl_waitpid" [75]=> string(18) " pcntl_wexitstatus" [76]=> string(16) " pcntl_wifexited" [77]=> string(18) " pcntl_wifsignaled" [78]=> string(17) " pcntl_wifstopped" [79]=> string(15) " pcntl_wstopsig" [80]=> string(15) " pcntl_wtermsig" [81]=> string(19) " apache_get_version" [82]=> string(14) " apache_getenv" [83]=> string(12) " apache_note" }

avatar hakanara
hakanara - comment - 27 Jul 2017

I am not a PHP guru, but just a learner. But as far as I understand, this part behaves strange:
This part returns 1 but it should return 0 right?
echo !in_array('parse_ini_file', $disabled_functions);

avatar hakanara
hakanara - comment - 27 Jul 2017

Because of the space at the begining of "parse_ini_file" string in the array, we can't match. It should be like " parse_ini_file" Is that right?

avatar wilsonge
wilsonge - comment - 27 Jul 2017

!in_array('parse_ini_file', array_map('trim', $disabled_functions));
What if we do this then. But yes looks like that's probably the issue

avatar hakanara
hakanara - comment - 27 Jul 2017

I will check it tomorrow. Why don't you simply search the string within the string without turning it into an array?

avatar hakanara
hakanara - comment - 29 Jul 2017

@wilsonge I have tried the last one you gave me and this time it returns empty value. It means it is working now. Without trimming it was giving 1 which was wrong. (which meant that the function did not exist in the array even though it existed)

So I have a question now, why dont you search the function name "parse_ini_file" within ini_get("disable_functions") without turning it into an array? Is it faster this way when it is an array?

avatar hakanara
hakanara - comment - 29 Jul 2017

Or without trimming you can implode the array as
$disabled_functions = explode(', ', ini_get('disable_functions'));

with a space right after the comma. Then there will be no need for trimming.

avatar wilsonge
wilsonge - comment - 29 Jul 2017

$disabled_functions = explode(', ', ini_get('disable_functions'));

The problem with that is that some hosts won't have spaces after the commas :) and then for them it will fail to explode

avatar zero-24
zero-24 - comment - 29 Jul 2017

But is not the extra space a problem of the hoster? Or is this common? As function_exists should handle that ini setting already.

avatar wilsonge
wilsonge - comment - 29 Jul 2017

It's probably a hosting problem (or maybe it's a PHP problem?? I don't know why PHP wouldn't trim internally). But it's very easy for us to work around. See #17332

avatar wilsonge wilsonge - change - 29 Jul 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-07-29 14:07:36
Closed_By wilsonge
avatar wilsonge wilsonge - close - 29 Jul 2017
avatar hakanara
hakanara - comment - 29 Jul 2017

@wilsonge and @zero-24 Thank you very much for all your efforts.

avatar wilsonge
wilsonge - comment - 29 Jul 2017

Can you mark a test on the PR in the issue tracker please https://issues.joomla.org/tracker/joomla-cms/17332

Add a Comment

Login with GitHub to post a comment