Error when marking multiple messages as spam
Open
Nobody has claimed this yet.
0. to triage
bug
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 348
- Avg merge
- 12h 28m
- Merged PRs (30d)
- 91
Description
Steps to reproduce
- Select multiple messages
- Mark as spam
Expected behavior
Mail should mark all selected messages as spam and move them to the junk follder
Actual behavior
Mail marks and moves one message
Mail app version
3.7.1
Mailserver or service
postfix/cyrus
Operating system
Linux/docker
PHP engine version
PHP 8.2
Web server
Nginx
Database
MariaDB
Additional info
Log:
{
"reqId": "hRC9q1s3nKwVvCDDY2f6",
"level": 3,
"time": "2024-06-07T08:04:48+00:00",
"remoteAddr": "192.168.10.1",
"user": "sgofferj",
"app": "PHP",
"method": "PUT",
"url": "/index.php/api/messages/12211/flags",
"message": "Undefined array key 64539 at /var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php#344",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0",
"version": "28.0.6.1",
"data": {
"app": "PHP"
}
}
{
"reqId": "hRC9q1s3nKwVvCDDY2f6",
"level": 3,
"time": "2024-06-07T08:04:48+00:00",
"remoteAddr": "192.168.10.1",
"user": "sgofferj",
"app": "mail",
"method": "PUT",
"url": "/index.php/api/messages/12211/flags",
"message": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 344",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0",
"version": "28.0.6.1",
"exception": {
"Exception": "Exception",
"Message": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 344",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\Mail\\Controller\\MessagesController"
],
"setFlags"
]
},
{
"file": "/var/www/html/lib/private/Route/Router.php",
"line": 315,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::",
"args": [
"OCA\\Mail\\Controller\\MessagesController",
"setFlags",
[
"OC\\AppFramework\\DependencyInjection\\DIContainer"
],
[
"12211",
"mail.messages.setFlags"
]
]
},
{
"file": "/var/www/html/lib/base.php",
"line": 1069,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/apps/mail/api/messages/12211/flags"
]
},
{
"file": "/var/www/html/index.php",
"line": 39,
"function": "handleRequest",
"class": "OC",
"type": "::",
"args": []
}
],
"File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"Line": 169,
"Previous": {
"Exception": "TypeError",
"Message": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/custom_apps/mail/lib/Service/MailManager.php",
"line": 410,
"function": "move",
"class": "OCA\\Mail\\IMAP\\MessageMapper",
"type": "->",
"args": [
[
"OCA\\Mail\\IMAP\\ImapClientRateLimitingDecorator",
[
"HICenv",
"HICflags",
"HIChdrs",
"HICdate",
"HICsize",
"And 1 more entries, set log level to debug to see all entries"
],
true,
true
],
"INBOX",
64539,
"INBOX.SPAM"
]
},
{
"file": "/var/www/html/custom_apps/mail/lib/Service/MailManager.php",
"line": 305,
"function": "moveMessageOnSameAccount",
"class": "OCA\\Mail\\Service\\MailManager",
"type": "->",
"args": [
[
"OCA\\Mail\\Account"
],
"INBOX",
"INBOX.SPAM",
64539
]
},
{
"file": "/var/www/html/custom_apps/mail/lib/Listener/MoveJunkListener.php",
"line": 73,
"function": "moveMessage",
"class": "OCA\\Mail\\Service\\MailManager",
"type": "->",
"args": [
[
"OCA\\Mail\\Account"
],
"INBOX",
64539,
[
"OCA\\Mail\\Account"
],
"INBOX.SPAM"
]
},
{
"file": "/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php",
"line": 86,
"function": "handle",
"class": "OCA\\Mail\\Listener\\MoveJunkListener",
"type": "->",
"args": [
[
"OCA\\Mail\\Events\\MessageFlaggedEvent"
]
]
},
{
"file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
"line": 230,
"function": "__invoke",
"class": "OC\\EventDispatcher\\ServiceEventListener",
"type": "->",
"args": [
[
"OCA\\Mail\\Events\\MessageFlaggedEvent"
],
"OCA\\Mail\\Events\\MessageFlaggedEvent",
[
"Symfony\\Component\\EventDispatcher\\EventDispatcher"
]
]
},
{
"file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
"line": 59,
"function": "callListeners",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
[
"Closure"
],
[
"Closure"
],
[
"Closure"
],
[
"Closure"
]
],
"OCA\\Mail\\Events\\MessageFlaggedEvent",
[
"OCA\\Mail\\Events\\MessageFlaggedEvent"
]
]
},
{
"file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
"line": 94,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
"OCA\\Mail\\Events\\MessageFlaggedEvent"
],
"OCA\\Mail\\Events\\MessageFlaggedEvent"
]
},
{
"file": "/var/www/html/custom_apps/mail/lib/Service/MailManager.php",
"line": 491,
"function": "dispatch",
"class": "OC\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
"OCA\\Mail\\Events\\MessageFlaggedEvent",
[
"OCA\\Mail\\Events\\MessageFlaggedEvent"
]
]
},
{
"file": "/var/www/html/custom_apps/mail/lib/Controller/MessagesController.php",
"line": 799,
"function": "flagMessage",
"class": "OCA\\Mail\\Service\\MailManager",
"type": "->",
"args": [
[
"OCA\\Mail\\Account"
],
"INBOX",
64539,
"$junk",
true
]
},
{
"file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"line": 230,
"function": "setFlags",
"class": "OCA\\Mail\\Controller\\MessagesController",
"type": "->",
"args": [
12211,
[
true,
false
]
]
},
{
"file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"line": 137,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\Mail\\Controller\\MessagesController"
],
"setFlags"
]
},
{
"file": "/var/www/html/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\Mail\\Controller\\MessagesController"
],
"setFlags"
]
},
{
"file": "/var/www/html/lib/private/Route/Router.php",
"line": 315,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::",
"args": [
"OCA\\Mail\\Controller\\MessagesController",
"setFlags",
[
"OC\\AppFramework\\DependencyInjection\\DIContainer"
],
[
"12211",
"mail.messages.setFlags"
]
]
},
{
"file": "/var/www/html/lib/base.php",
"line": 1069,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/apps/mail/api/messages/12211/flags"
]
},
{
"file": "/var/www/html/index.php",
"line": 39,
"function": "handleRequest",
"class": "OC",
"type": "::",
"args": []
}
],
"File": "/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php",
"Line": 344
},
"message": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 344",
"exception": {},
"CustomMessage": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 344"
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/IMAP/MessageMapper.php line 344, then trace the move call through MailManager.php, MoveJunkListener.php, and MessagesController.php using the supplied stack trace. Reproduce marking multiple messages as spam and verify that every selected message is moved to the junk folder without the undefined array key or null return error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100