When user send bulk messages for example to all group members in a group, the message does not deliver. Furthermore, we do not receive any form of error notification or feedback regarding the delivery failure.

After an investigation has been discovered that during this activity it generates the following error:

TypeError: array_map(): Argument #2 ($array) must be of type array, bool given in /app/html/modules/contrib/social_pwa/src/WebPushManager.php on line 71 #0 /app/html/modules/contrib/social_pwa/src/WebPushManager.php(71): array_map(Object(Closure), false)
#1 /app/html/modules/contrib/social_pwa/modules/activity_send_push/src/Plugin/ActivitySend/PushActivitySend.php(98): Drupal\social_pwa\WebPushManager->getSubscriptionsForUser(Object(Drupal\social_user\Entity\User))
#2 /app/html/modules/contrib/social_pwa/modules/activity_send_push/activity_send_push.module(24): Drupal\activity_send_push\Plugin\ActivitySend\PushActivitySend->process(Object(Drupal\activity_creator\Entity\Activity))
#3 [internal function]: activity_send_push_activity_insert(Object(Drupal\activity_creator\Entity\Activity))
#4 /app/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array(Object(Closure), Array)
#5 /app/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'activity_send_p...')
#6 /app/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): Drupal\Core\Extension\ModuleHandler->invokeAllWith('activity_insert', Object(Closure))

Proposed resolution

Add a check to make sure that user data is always as an array because get() has a mixed type of return value: array, null, bool.

Issue fork social_pwa-3425488

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

SV created an issue. See original summary.

sv’s picture

Issue summary: View changes
ribel’s picture

Title: Bulk Messages not delivering » Make sure that user data is always array to prevent fatal error
Status: Active » Reviewed & tested by the community

Changes were tested and works without regression.

sv’s picture

Issue summary: View changes

  • robertragas committed 047d93b9 on 2.0.x authored by SV
    Issue #3425488 by SV: Make sure that user data is always array to...

  • robertragas committed 05dc48f2 on 2.1.x authored by SV
    Issue #3425488 by SV: Make sure that user data is always array to...
robertragas’s picture

Status: Reviewed & tested by the community » Fixed

Merged and will be landing in 2.0.5 and 2.1.2

robertragas’s picture

Status: Fixed » Closed (fixed)

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