User tests: Successful: Unsuccessful:
Pull Request for Issue #14951 .
remove notice Undefined variable: ntext
Create a menu with a menu item.
Disable this menu.
Try to enable the menu item under this menu.
no notice
PHP Notice: Undefined variable: ntext in \administrator\components\com_menus\controllers\items.php on line 248
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_menus |
Labels |
Added:
?
|
you are 2 fast 4 me
Set Error reporting to Maximum but don't get a PHP-Notice, only "Error"-Message is shown.
I have tested this item
@franz-wohlkoenig
after patching no more Notice in php logs.
We only get the Error message as should.
@alikon
NOTE: I remarked something else that may be worth looking into. Unrelated to this PR.
Test:
Create a parent menu item and a few children.
Whether you publish or unpublish the parent, the Message states only 1 menu item is published/unpublished, although all children are also concerned and change status.
yes is unrelated to this pr, but @infograf768 you can look at #13242
Personal, I think we can simplify the code of the PR a bit:
try
{
$model->publish($cid, $value);
$errors = $model->getErrors();
$messageType = 'message';
if ($value == 1)
{
if ($errors)
{
$messageType = 'error';
$ntext = $this->text_prefix . '_N_ITEMS_FAILED_PUBLISHING';
}
else
{
$ntext = $this->text_prefix . '_N_ITEMS_PUBLISHED';
}
}
elseif ($value == 0)
{
$ntext = $this->text_prefix . '_N_ITEMS_UNPUBLISHED';
}
else
{
$ntext = $this->text_prefix . '_N_ITEMS_TRASHED';
}
$this->setMessage(JText::plural($ntext, count($cid)), $messageType);
}
catch (Exception $e)
{
$this->setMessage($e->getMessage(), 'error');
}
Compare to the propose code;
It doesn't have to call app->enqueueMessage to queue the message
Doesn't have to call $this->setMessage, JText::plural on each part in if else if. I think the code is easier to read
It requires an extra variable to store $messageType, thought.
@infograf768 thanks for Info.
I have tested this item
@alikon Thanks for making the changes
@infograf768 Please re-test
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
@joomdonation i really like when we can simplify stuff
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-03-30 21:40:58 |
Closed_By | ⇒ | rdeutz | |
Labels |
Added:
?
|
This still seems to be a problem after the official 3.7 release, at least in some cases. One of my grammar-school websites is facing this problem (http://grandaskoli.is). Any idea what couses this? Could an addon be interfearing in any way?
You should open an issue if you think it is an error, but getting the message is not a problem when the error condition is met.
Please open a new issue with the exact steps to reproduce this. Your error looks not realted to this PR.
Without PR there is an "Error"-Message, with PR there is a Message too: