Error: Cannot use object of type Drupal\Core\StringTranslation\TranslatableMarkup as array

Created on 7 August 2024, 8 months ago

Problem/Motivation

This error shows up on the "Pull entities page", when trying to pull a content.

Error: Cannot use object of type Drupal\Core\StringTranslation\TranslatableMarkup as array in entity_share_websub_subscriber_form_entity_share_client_pull_form_alter() (line 90 of /var/www/html/web/modules/contrib/entity_share_websub/modules/entity_share_websub_subscriber/entity_share_websub_subscriber.module).

Steps to reproduce

Create channels on both server and client side
Create any content on client side.
Import any content from client side.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇮🇳India ayush.pandey

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ayush.pandey
  • 🇬🇧United Kingdom aaron.ferris

    Don't think this is the right module issue queue?

  • Status changed to Needs review 8 months ago
  • 🇮🇳India sarwan_verma

    Hi,

    I have fixed this issue "Error: Cannot use object of type Drupal\Core\StringTranslation\TranslatableMarkup as array" and also attached patch,
    please review and verify.

  • 🇳🇱Netherlands jeroen dost

    Hi @sarwan_verma,

    This does not seem to fix the problem. I still get the error. `$row['status']['data']` is of type TranslatableMarkup and should be handled like that. I don't know if it always is an object of that type, so we could check for it, but I could not get it to work. Problem starts probably because the status is not one of the statuses inSubscriptionManager getStatusLabel().

    I can probably try to patch this next week.

  • Status changed to Needs work 7 months ago
  • 🇺🇸United States fathershawn New York

    Moving back to "needs work" based on the review in #5

  • 🇳🇱Netherlands jeroen dost

    I cannot reproduce the error anymore. Maybe a setting was wrong before. If I come across it again, I will update this issue.

  • Status changed to Postponed: needs info 7 months ago
  • 🇺🇸United States fathershawn New York
  • 🇺🇸United States fathershawn New York
  • Status changed to Closed: cannot reproduce 4 months ago
  • 🇺🇸United States fathershawn New York

    Closing per #7

  • 🇳🇱Netherlands jeroen dost

    The problem turned up again. I think it is related to the fact that the status column shows somehing different than
    ```
    Subscriber::SUBSCRIPTION_CANCELLED => 'Cancelled',
    Subscriber::SUBSCRIPTION_VERIFIED => 'Subscribed',
    Subscriber::SUBSCRIPTION_NOT_VERIFIED => 'Not verified',
    ```
    when the subscription is cancelled and the content is not synchronized (or when it is synchronized and status shows that).
    Maybe `$row['status']['data']` or `$row['status']` is previously already set to a translatable markup and cannot be changed at this point?

  • 🇺🇸United States fathershawn New York

    Do you have steps to reproduce?

Production build 0.71.5 2024