User tests: Successful: Unsuccessful:
Pull Request for Issue #13608
When saving Global Configuration and Path to Cache Folder
is empty, we get a Notice in the PHP logs:
[16-Jan-2017 16:07:25 UTC] PHP Notice: Undefined index: cache_path in /administrator/components/com_config/model/application.php on line 290
This came from the merged PR #13520
Test before and after patch.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_config |
@franz-wohlkoenig
Have you looked at the php_error.log file as this Notice is not going to display in the browser window?
The easiest way to see error is adding this command
die();
after this line https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_config/model/application.php#L387
I think $data['cache_path'] is always available, so actually, to prevent the notice, we only have to check !empty($prev['cache_path'])
So the code would become:
if ($data['cache_path'])
{
$path = $data['cache_path'];
}
elseif (!$data['cache_path'] && !empty($prev['cache_path']))
{
$path = $prev['cache_path'];
}
else
{
$path = JPATH_SITE . '/cache';
}
Or even simpler
if ($data['cache_path'])
{
$path = $data['cache_path'];
}
elseif (!empty($prev['cache_path']))
{
$path = $prev['cache_path'];
}
else
{
$path = JPATH_SITE . '/cache';
}
I have tested this item
thanks for helping, @joomdonation
You're welcome @franz-wohlkoenig . If @infograf768 agree with my suggested changes, we will need your help re-test this PR again.
will do.
Labels |
Added:
?
|
@franz-wohlkoenig @joomdonation Simplified as suggested, please test again.
I have tested this item
@infograf768 Thanks for making the changes. I marked the test result.
Notice: Undefined index: cache_path in /var/www/web17/html/Joomla/administrator/components/com_config/model/application.php on line 290
Maybe cause couldn't install todays nightly build (Download of update package failed.
).
Blank site? Before you press save or after pressing save? Maybe it is blank because you added die(); command?
After pressing save. Maybe because of die();
but to see the Notice isn't it helpful?
Yes. The die(); command is used to allow you to see notice before patch. After patch, you see blank screen means no notice anymore
So for now, you should remove the die(); command, then save the configuration again. If configuration (especially cache path) is being saved, then you can mark the test result as success
I have tested this item
@joomdonation haven't known that there's a beta1 and custom-path-update didn't work. After installing beta1 test was sccessfully.
If I read the code correctly, there is still a problem with the code at this line https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_config/model/application.php#L305
(of course not related to this PR)
Since we need to check and make sure the custom cache path is valid, I think the code should be chane from
if ($path !== JPATH_SITE . '/cache' && @opendir(JPATH_SITE . '/cache') != false)
To
if ($path !== JPATH_SITE . '/cache' && @opendir($path) != false)
Could someone looks at it?
@joomdonation
I suggest you create a new PR as this one deals only with the Notice. And tag @mbabker as he is the one who created the original PR.
I mark this one as RTC
Status | Pending | ⇒ | Ready to Commit |
RTC. Thanks.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-01-20 10:17:28 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
With and without Patch didn't get a Notice.