I've got a "The source domain must be selected as a publishing option." error whenever I try to update a content.

On the "Domain Source" module ( file domain_source.module line 130 ) there is the domain_source_form_validate function.

As far as I understand this, it checks if the current content have a valid source. But on line 142 :

if ($value == $source_value) {

This check seems wrong ( at least on my end )

We need to replace this by :

if ($value == $source_value['target_id']) {

If I do this change, everything works.

Comments

Mistrae created an issue. See original summary.

agentrickard’s picture

Status: Active » Postponed (maintainer needs more info)

We have a test for this behavior in Drupal\Tests\domain_source\Functional\DomainSourceElementTest

Can you please post a screen shot of the Domain and Domain Source field settings on that node before you try to save.

mistrae’s picture

This is was I get when I dump $value and $source_value on the domain_source_form_validate function plus a screen of the domain settings on the node.

agentrickard’s picture

Interesting.

What versions of Domain and Drupal are you running?

Stephen Rockwell’s picture

I think i'm seeing a related issue on new and update content. :

Warning: current() expects parameter 1 to be array, null given in domain_source_form_validate() (line 134 of modules/contrib/domain/domain_source/domain_source.module).

using domain alpha11 and drupal 8.4.3

agentrickard’s picture

@Stephen Rockwell

Please provide steps to reproduce that error.

As I said above, we have a test for this behavior in Drupal\Tests\domain_source\Functional\DomainSourceElementTest that doesn't fail.

Stephen Rockwell’s picture

Any new or updated content on any domain, after update from alpha 9 to 11

agentrickard’s picture

That is not a helpful answer.

I need a list of steps to take to reproduce the issue. How many domains? What content type? What actions are you taking?

Stephen Rockwell’s picture

20 domains and it happens on every domain including primary domain.

It happens on every content type and on every domain creating or updating a node.

agentrickard’s picture

I'll look at it, but for future reference, please read https://www.drupal.org/node/73179#issue_summary and report issues with lists of steps to replicate.

agentrickard’s picture

StatusFileSize
new40.26 KB

Cannot replicate on Drupal 8.5 HEAD, PHP 7.1.

Have you changed any of the default field settings?
Is the Domain Source field still a select box?

A screen capture of the Domain fields

If you don't provide reliable steps to reproduce, I am forced to waste my time and yours guessing.

agentrickard’s picture

And I've improved the test to match your description of the issue. This test will run for Drupal 8.4 and 8.5 on PHP 5.5, 5.6, 7.0, and 7.1

https://github.com/agentrickard/domain/pull/398

The tests run on Travis. You can see the results here -- https://travis-ci.org/agentrickard/domain/builds/324152446?utm_source=gi...

fazni’s picture

Hi @agentrickard,

After update core Drupal 8.3 to 8.4 on PHP 7.1, I had the same problem.

Thanks

agentrickard’s picture

@fazni

I NEED STEPS TO REPLICATE.

HOW CLEAR DO I HAVE TO BE BEFORE SOMEONE GIVES ME THE PROPER INFORMATION.

Stephen Rockwell’s picture

I was able to resolve by disabling and then re-enabling the module. The error message is no longer.

I'm terribly sorry about steps to replicate. I thought I was providing the information you needed.

I was in a 8.3 environment and upgraded to 8.4 at the same time going from domain alpha 9 to alpha 11. I used composer for these updates.

I did follow the additional steps for upgrading from alpha 9 to alpha 10 including disabling domain config before updating and then re-enabling.

- this is php 7.1 as well.
- again this happens on every domain including primary and I have 20 domains.

Thanks for your assistance and a great module.

agentrickard’s picture

@stepthen Rockwell

Thank you. It was just getting a little de-motivating to have several people not answer a basic question.

I'm going to look at wrapping some of those calls in isset() to prevent the issue.

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Fixed
StatusFileSize
new1.05 KB

OK, I updated the tests and added the following error handling.

  • agentrickard committed 28ce87d on 8.x-1.x
    Issue #2931544 by agentrickard, Mistrae, Stephen Rockwell: Source domain...

Status: Fixed » Closed (fixed)

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

j.b’s picture

Sorry to reopen this,

I had the same issue. I disabled the domain source module and then re-enabled it, this corrects the issue.
However, I actually did that on my development platform and lost all the saved values of the domain source field.

I previously ran Drupal 8.3.7 and domain 8.x-1.0-alpha11 without any issues.

Error occurs after updating to Drupal 8.4.4, regardless of domain 8.x-1.0-alpha11 / domain 8.x-1.0-alpha12

Is there a way to disable the module or solve the issue without losing content of the domain source field.

agentrickard’s picture

@j.b. You did not change the issue status to re-open this. Let's address it over in the other issue.