? ? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
16 Jan 2017

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.

@mbabker

avatar infograf768 infograf768 - open - 16 Jan 2017
avatar infograf768 infograf768 - change - 16 Jan 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Jan 2017
Category Administration com_config
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 16 Jan 2017

With and without Patch didn't get a Notice.

avatar infograf768
infograf768 - comment - 17 Jan 2017

@franz-wohlkoenig
Have you looked at the php_error.log file as this Notice is not going to display in the browser window?

avatar joomdonation
joomdonation - comment - 17 Jan 2017

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

@infograf768

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';
}
avatar joomdonation
joomdonation - comment - 17 Jan 2017

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';
}
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 17 Jan 2017

I have tested this item successfully on b344bf3


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

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 17 Jan 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 17 Jan 2017

thanks for helping, @joomdonation

avatar joomdonation
joomdonation - comment - 17 Jan 2017

You're welcome @franz-wohlkoenig . If @infograf768 agree with my suggested changes, we will need your help re-test this PR again.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 17 Jan 2017

will do.

avatar infograf768 infograf768 - change - 19 Jan 2017
Labels Added: ?
avatar infograf768
infograf768 - comment - 19 Jan 2017

@franz-wohlkoenig @joomdonation Simplified as suggested, please test again.

avatar joomdonation
joomdonation - comment - 19 Jan 2017

I have tested this item successfully on b069f82


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

avatar joomdonation joomdonation - test_item - 19 Jan 2017 - Tested successfully
avatar joomdonation
joomdonation - comment - 19 Jan 2017

@infograf768 Thanks for making the changes. I marked the test result.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 19 Jan 2017
  1. Tested with PR got a blank Site,
  2. tested without PR got 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.).

avatar joomdonation
joomdonation - comment - 19 Jan 2017

Blank site? Before you press save or after pressing save? Maybe it is blank because you added die(); command?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 19 Jan 2017

After pressing save. Maybe because of die(); but to see the Notice isn't it helpful?

avatar joomdonation
joomdonation - comment - 19 Jan 2017

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

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 19 Jan 2017

I have tested this item successfully on b069f82


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

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 19 Jan 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 19 Jan 2017

@joomdonation haven't known that there's a beta1 and custom-path-update didn't work. After installing beta1 test was sccessfully.

avatar joomdonation
joomdonation - comment - 19 Jan 2017

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?

avatar infograf768
infograf768 - comment - 19 Jan 2017

@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

avatar infograf768 infograf768 - change - 19 Jan 2017
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 19 Jan 2017

RTC. Thanks.


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

avatar wilsonge wilsonge - change - 20 Jan 2017
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: ?
avatar wilsonge wilsonge - close - 20 Jan 2017
avatar wilsonge wilsonge - merge - 20 Jan 2017

Add a Comment

Login with GitHub to post a comment