SubscribtionManager.php::169, the unsubscribe() function throws an exception if we try to (bulk) delete a non-existing e-mail address. While this is an error all right, it shouldn't result in a WSOD but caught at a higher level and turned into an appropriate warning.

Comments

djg_tram created an issue. See original summary.

adamps’s picture

I agree the existing situation is unhelpful and inconsistent. Most often you don't see the problem from the UI because somewhere along the way the module creates a temporary in-memory subscriber so avoids the error. It would be useful please to update the issue summary to describe the steps to see this error.

We need to think carefully about the best resolution.

  1. If the intention is "please delete all state relating to this email address" then it's not really an error - there is no state and we can just return.
  2. If the intention is "please store an explicit record that this email address unsubscribed" then it's not necessarily an error either - we can store the unsubscribe record even though there wasn't an existing subscription.

This relates to #3035367: Track history of subscribe/unsubscribe and proof of consent and #2965662: [META] GDPR Compliance.

nofue’s picture

A client gets this message on a Vs. 9 site using simplenews 3.0.0-beta4
unsubscribing non-existent subscribers:

Exception: The subscriber does not exist. in Drupal\simplenews\Subscription\SubscriptionManager->unsubscribe() (Zeile 156 in …/web/modules/contrib/simplenews/src/Subscription/SubscriptionManager.php).

The issue can be triggered by simply entering a non existent e-mail address to the "mass unsubscribe" field, checking one or any number of newsletters and letting go. Obviously something has been changed in the module, as the line is now line 156 instead of 169 as reported previously.

adamps’s picture

Version: 8.x-2.x-dev » 4.x-dev

We can just ignore the missing subscriber (return instead of throwing the exception)

adamps’s picture

Status: Active » Needs review
StatusFileSize
new3.98 KB
adamps’s picture

Status: Needs review » Needs work

The last submitted patch, 5: simplenews.remove-non-existing.3094920-5.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new14.39 KB
new600 bytes
adamps’s picture

StatusFileSize
new4.63 KB

Status: Needs review » Needs work

The last submitted patch, 9: simplenews.remove-non-existing.3094920-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new5.44 KB
new713 bytes

  • AdamPS committed dc27e093 on 4.x
    Issue #3094920 by AdamPS: Exception when removing non-existing e-mail
    
adamps’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.