Problem/Motivation

When attempting to sync sitewide alert entities with Acquia Content Hub the following error occurs when exporting content:

ResponseText: The website encountered an unexpected error. Try again later.TypeError: Drupal\sitewide_alert\Entity\SitewideAlert::getCreatedTime(): Return value must be of type int, string returned in Drupal\sitewide_alert\Entity\SitewideAlert->getCreatedTime() (line 159 of modules/contrib/sitewide_alert/src/Entity/SitewideAlert.php).

This issue seems similar to the linked related issue in being an issue with the stored value or return type being mismatched.

Wrapping the return in an inval() bypasses the issue, but the problem should most likely be solved another way.

Steps to reproduce

Using Acquia Content Hub setup content syncing for Sitewide alerts.

Create an alert.

Attempt to execute the Content Hub queue.

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

ibullock created an issue. See original summary.

nickolaj made their first commit to this issue’s fork.

nickolaj’s picture

Status: Active » Needs review

Added `(int)` cast to the return value of `getCreatedTime()` in `SitewideAlert.php` to handle the case where the `created` field value is returned as a string (e.g. when processed by Content Hub queue), consistent with how `getDismissibleIgnoreBeforeTime()` already handles this in the same class