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
Fix Language parsing when parse_ini_file disabled #15620
Conversation
closes #15587 Use sensible code available in FOF to process ini files when moronic web hosts disable parse_ini_file in php.ini Please test
@PhilETaylor shouldn't this be conditional, if php_ini_parse not exist then use FOF? |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
Still, this will be faster (one less file, less memory for the good hosts): if (!function_exists('parse_ini_file'))
{
$strings = FOFUtilsIniParser::parse_ini_file($filename, true);
}
else
{
$strings = @parse_ini_file($filename);
} |
Should we really create another dependencey to FOF where we try to remove it at other places? |
This comment was marked as abuse.
This comment was marked as abuse.
$strings = @parse_ini_file($filename); | ||
if (!function_exists('parse_ini_file')) | ||
{ | ||
return FOFUtilsIniParser::parse_ini_file_php($filename, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we can not use the old way before #13407?
return @parse_ini_string(file_get_contents($filename));
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as we restore:
$contents = file_get_contents($filename);
$contents = str_replace('_QQ_', '"\""', $contents);
$strings = @parse_ini_string($contents);
That should do the trick.
In case the new function is not there.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the idea was improve performance. Please replace above line as I suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No just as fallback when the new code don't work for b/c? (as respose to @PhilETaylor)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This $contents = str_replace('_QQ_', '"\""', $contents);
is not needed. I tested on php7.0
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously just using parse_ini_file
is simpler than using parse_ini_string
and file_get_contents
. That's probably the main reason it has been changed.
And as you can read in that PR, there is some automatic handling of QQ
Using FOF certainly isn't right. |
This comment was marked as abuse.
This comment was marked as abuse.
why do you think so? parse_ini_file can do that: http://php.net/manual/en/function.parse-ini-file.php
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.. |
This comment was marked as abuse.
This comment was marked as abuse.
As i have said i have not checked it yet and i have not saw that comment above. Needs to be tested. |
Honestly, just revert #13407. |
This comment was marked as abuse.
This comment was marked as abuse.
@Bakual i think the rest (array + renaming a var) can stay from that PR? Just that str_replace needs to be checked i guess. |
This comment was marked as abuse.
This comment was marked as abuse.
You absolutely can not remove the qq processing!! |
Do not revert #13407 The only thing you need to do is basically
|
For testers: |
This comment was marked as abuse.
This comment was marked as abuse.
Constants for Constants are not supported in hhvm 3.19.1 and lower at all for both ( 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:
|
This comment was marked as abuse.
This comment was marked as abuse.
If you will add unittest for |
Afaik currently unit tests run on HHVM. But the CMS itself not necessary. To my knowledge we don't support it yet officially. |
$strings = $this->inspector->parse(__DIR__ . '/data/bad.ini'); | ||
/** | ||
* suppressor used as we know this will generate a warning message | ||
* syntax error, unexpected BOOL_TRUE in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in.........
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coluld this https://github.com/PhilETaylor/joomla-cms/pull/1 can be useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I don't think it's even worth the effort to support HHVM anymore. Seems it is losing traction with the PHP community and big players are dropping support for it because apparently it doesn't have feature parity with PHP core starting with 5.6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not care about HVVM support but I want to enforce a unit test for _QQ_
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mbabker About my proposed changes. Would it be better to remove lines with hhvm support and allow the unit test on hhvm to fail? Or better way is to not add a unit test for _QQ_
now?
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Can some test this so that we can get this in 3.7.1? |
|
||
if (!is_array($strings)) | ||
{ | ||
$strings = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PhilETaylor If you are not convinced about merge my PR can you at least remove a ternary operator from line 857:
return is_array($strings) ? $strings : array();
which is equal to your new code:
if (!is_array($strings))
{
$strings = array();
}
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
This comment was marked as abuse.
This comment was marked as abuse.
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. |
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. |
RTC after two successful tests. |
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. |
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 :) |
* Fix Language parsing when parse_ini_file disabled closes joomla#15587 Use sensible code available in FOF to process ini files when moronic web hosts disable parse_ini_file in php.ini Please test * Only load FOFUtilsIniParser if needed * Tabs not spaces * Unit Testing * tabs not spaces - darn editors * TABS! * Different approach * remove QQ replacement (apparently its not needed) * re-add QQ replacement (apparently its needed) * Revert joomla#13407 almost :) * ok back to this if/else * Update Unit Testing * Update Unit Testing * remove a ternary operator
Hi all, this issue is still existing with a fresh 3.7.2 installation. Shall I open a new issue? |
Yes please |
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! |
You are all invited to the reopening of #17198 |
closes #15587
Use sensible code to process ini files when moronic web hosts disable parse_ini_file in php.ini
Please test