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?
Upgrade from 3.6 to 3.7.3
All the backend and frontend language strings to appear as defined in language files
None of the strings are parsed and they look like the screenshot below:
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
Please find a stable solution for this issue without having me contacting the hosting company after upgrading each site.
Labels |
Added:
?
|
Category | ⇒ | com_joomlaupdate Language & Strings |
Rel_Number | 0 | ⇒ | 15587 |
Relation Type | ⇒ | Duplicate of |
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.
I had a similar problem in my plugins - resolved by replacing _QQ_
with \ "
. See backbutton/content-plugin#9
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();
parse_ini_file
The current PHP Version is 5.6.31
I can change the PHP version from cpanel and test with different php versions if necessary?
hmm this mean the php feature is implemented but failing.. Can you reproduce this using a core only install on the same webserver?
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.
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.
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 ?
This depends on your server setup. Please check the patch i have linked above.
What language is that? It may be an error in the language pack?
Turkish
Even if it would be a broken language. The fallback should be parse_ini_string ;)
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).
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.
Sounds like that. So please check the patch i have provided above. Thanks.
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.
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. :-)
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
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?
Please check with your hosting if they use the 'suhosin' extension to disable that function.
<?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?
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.
Status | New | ⇒ | Discussion |
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?
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.
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();
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.
<?php
$disabled_functions = explode(',', ini_get('disable_functions'));
var_dump($disabled_functions);
So if you run this on your server what's the result?
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" }
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);
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?
!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
I will check it tomorrow. Why don't you simply search the string within the string without turning it into an array?
@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?
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.
$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
But is not the extra space a problem of the hoster? Or is this common? As function_exists
should handle that ini setting already.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-07-29 14:07:36 |
Closed_By | ⇒ | wilsonge |
Can you mark a test on the PR in the issue tracker please https://issues.joomla.org/tracker/joomla-cms/17332
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?