-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[5.3] Remove unsed variable messages from enqueue messages #42948
Conversation
This should be properly tested as the function getMessageQueue initializes $this->messageQueue which is used later down. I don't think so we can remove that line. Perhaps the returned $messages variable should be used instead of $this->messageQueue. |
Then we let it as is. Just looks weird in the IDE. |
What you can remove is |
shouldn't it be |
Better remove the line as you did here, and replace next line with if (!\in_array($message, $this->getMessageQueue())) {
// Enqueue the message.
$this->messageQueue[] = $message;
}
|
@joomdonation I think with this changes we losing the context, I would suggest to keep that comment and the logic. Kind of: // For empty queue, if messages exists in the session, enqueue them first.
$this->getMessageQueue();
if (!\in_array($message, $this->messageQueue)) {
// Enqueue the message.
$this->messageQueue[] = $message;
} |
@chmst @Fedik That also works, but it is also a bit confusing when calling method returns data but we do not use that returned data for any thing. Honestly, I don't know what's better, but I would also not complain if your code is used. The most important thing is get rid of unused variable so that the code is not being removed by mistake in the future. |
Agree with @joomdonation |
The problem, that in future, someone may refactor that code, and just replace Because, why not? But it is important to call It can stay as you made, but then please add a comment with explanation. |
@Fedik what about that comment? |
Good enough, thanks 😉 |
I wouldn't do this in 4.4 and move it 5.2 since it doesn't solve a bug. |
@chmst will you be rebasing this? |
Could those who worked on this PR already test it again? That way it could be merged into 5.2. |
The PR has been rebased. Could you retest this so that we can merge this into 5.2? |
This pull request has been automatically rebased to 5.3-dev. |
I have tested this item 🔴 unsuccessfully on 208df7a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42948. |
I have tested this item 🔴 unsuccessfully on 208df7a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42948. |
I have tested this item ✅ successfully on 26125e1 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42948. |
I have tested this item ✅ successfully on 26125e1 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42948. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42948. |
Thanks! |
Pull Request for Issue # .
Summary of Changes
As title says, there is an unused variable.
Testing Instructions
Test different situations where messages are sent and also enqueued, like here

All messages must be the same before and after patch