On a site with Scheduled Updates and Workbench Moderation and a scheduled update setup for the moderation state I get an uncaught exception when trying to edit a node that was published with only the default revision.
Reproduction Steps:
- Install both modules
- Setup a moderated content type can be published without going through "Needs revision"
- Setup a Scheduled update field on the moderation state using latest revision runner and advanced settings (these may not matter but are the use case I've tried):
- After update behavior: Archive updates
- Invalid update behavior: Leave In Queue
- Create New Revisions: Always create new revision
- Run update as: Owner of revision
- Create a new node.
- During the creation process click the add new published draft button (or whatever you labeled the update) then click cancel.
- Save the node to immediately publish.
- Click the "create new draft" tab
The page shows:
The website encountered an unexpected error. Please try again later.
And the error log reads:
2016/08/17 15:33:42 [error] 923#923: *800 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Exception: "The timestamp must be numeric." at /var/www/vhosts/www.example.org/pub/core/lib/Drupal/Component/Datetime/DateTimePlus.php line 172" while reading response header from upstream, client: 192.168.2.1, server: www.example.org.sandbox$, request: "GET /node/51/edit HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.example.org.sandbox", referrer: "http://www.example.org.sandbox/devel/node/51"
The exception is triggered by ScheduledUpdate.php in the label() method at line 260 (in current dev release). $this->get('update_timestamp')->getString() returns null, and the DateTime formatter will not accept. If you add a simple error trap to that function you get a blank entity attached:
public function label() {
/** @var \Drupal\Core\Datetime\DateFormatterInterface $formatter */
$formatter = \Drupal::service('date.formatter');
if($this->get('update_timestamp')->getString()){
return $formatter->format($this->get('update_timestamp')->getString());
} else {
return False;
}
}This may be a bug in Inline Entity Form, but since the invalid entity is a ScheduledUpdate it seems likely to a problem here. At the moment my solution just treats the symptom.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | MissingTimeStamp.PNG | 5.53 KB | acrosman |
Comments
Comment #2
acrosmanComment #3
acrosmanComment #4
bkosborneI tried reproducing this but couldn't, although I think I was confused by a couple of your steps:
So in essence don't create a scheduled update at all? Since you clicked cancel?
Meaning set the moderation state to "published" in the node creation form, so that it never enters the draft state?
Comment #5
acrosmanIt looks like it resolved after some update or another to core or Inline Entity Form in the last few months. At least I can't get my steps to work anymore.
Yes, the problem was if you started to create an scheduling entity and then bailed without meaning to complete the process an invalid entity was generated.