Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7
-
Fix Version/s: None
-
Component/s: None
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:Developer Doc
-
Funding Source:Needs Funding
-
Verified?:No
Description
Currently, CiviMailUtils::clearMessages() clears one message from the message log per default.
The function docs say "Remove any sent messages from the log.", but the default $limit value is 1.
- This means that the function name and docs are not consistent with the behaviour.
- This also leads to developers putting arbitrary-but-large numbers in tests ($mut->clearMessages(999)), which introduces more WTF ("What is the 999 here?") and is not guaranteed to clear all messages.
I propose that we set the default $limit to 0 instead, meaning that the behaviour is more consistent with the function naming and docs, and that code which actually requires a single message to be removed just use $mut->clearMessages(1).
Whether this is an external interface might affect whether this is a behaviour change in CiviCRM?