Hi,

After migrating (D6 to D8) I get this issue when I want to run cron with drush:

 drush @vmdevd8ce cron
PHP Fatal error:  Unsupported operand types in /var/www/drupal-8/core/lib/Drupal/Core/Utility/LinkGenerator.php on line 153
Drush command terminated abnormally due to an unrecoverable error.                                                                                                    [error]
Error: Unsupported operand types in /var/www/drupal-8/core/lib/Drupal/Core/Utility/LinkGenerator.php, line 153

            <div class="field field--name-field-lien-interne field--type-link field--label-hidden field__item">

via the UI I get a WSOD.

I don't know what I can check or set to avoid this error.
Possibly related to my uncomplete block migration ?

                                            Etat  Total  Imported  Unprocessed
 d6_block                                          Idle  415    27        0 

Thanks

Comments

aiphes created an issue. See original summary.

aiphes’s picture

Issue summary: View changes
cilefen’s picture

Priority: Normal » Major

That is happening because $variables on line 153 is not an array so it cannot be added to an array with the '+' operator (as in $foo = [] + '' produces this). If you put a breakpoint there, or even just var_dump $variables and exit, you may get an idea of the cause. Is the chunk of HTML in the issue summary actually part of the Drush output? What's the Drush version?

(edited for clarity)

aiphes’s picture

yes it's the Drush output, and is version is :

Drush version                   :  8.1.16
Drupal version                  :  8.6.1

Do the incomplete block migration could be one cause ?

aiphes’s picture

This error happen at the same time.Perhaps related ?
EDIT: I can reproduce the error happening when I run d6_term_node:1 migration with drush.Rollback doesn't clear the error on Cron.

cilefen’s picture

Because according to #3000611: Could not load data, please refresh the page error you can reproduce this in the UI, it's probably not caused by Drush. Be aware you should be on Drush 9 with Drupal 8.4+.

Let's see what you find by debugging (#3) and you should execute Drush in verbose mode.

aiphes’s picture

Actually the Coffee bug doesn't happen so it's not really related.
This is the cron debug mode: https://gist.github.com/webmasterpf/3ec7da7b7a54ecb9c57eaa79d79faf9a

I need Drush 8 because I manage D6 and D8 websites until the end of migrations (8 websites to go).

aiphes’s picture

Content of 2 differents content type cause this error and break the CRON.
No common fields, each use linkfield, reference entity field (taxonomy),image field(multi-value).
How can I do debug as #3 suggest ?

aiphes’s picture

After looking into data in db and compare between D6 and D8, I see empty db fields for these linkfield.
I have a linkfield with no migration issue, and source db field isn't empty.
On my 2 content types with errors, there are db field:
For example, the field_lien_externe_url db field take normally url's OR NULL if no data, but it happens db field empty.
I think this could be the origin of the error.
So how can I replace empty data by NULL mention in db field ? search and replace in db ? To test my theory.

aiphes’s picture

I compared records in content_field_lien_externe D6 table and node__field_lien_externe D8 table .
It appears that all records with NULL or empty label/field aren't migrated (ignored).
So the D6 table with 312 records go to 23 records after migration into D8 db. This is why the linkgenerator error happen I guess.

Can I force migration of all records with a custom migration module ? If yes, how to map them ? Actually I do this whithout changes on this error:

 field_lien_externe:
     plugin: d6_cck_link
     source: field_lien_externe
aiphes’s picture

Reviewing records from working content migration, it appear that empty and NULL label are skipped as a normal way.
So my issue, come from a corrupted data or something like in a record...will not be easy to find.
EDIT: finally, records from the content_field_lien_externe table (D6) (199 non empty records over 312 in all) are dispatched in node_revision__field_lien_externe table (199 records) and node__field_lien_externe table (D8)(23 records). Are these 23 twice records cause error ?

aiphes’s picture

I investigate more and more and I get the culprit node (one of) among all nodes for a content type that break CRON.
In DB records, I see a difference,perhaps the cause, but I don't know what about is it.This is extraction records from D8 DB:

bundle;deleted;entity_id;revision_id;langcode;delta;field_lien_interne_uri;field_lien_interne_title;field_lien_interne_options
page_fiche_formation;0;7;7;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;10;504;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;11;11;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;13;384;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;14;172;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;15;515;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;16;348;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;17;571;fr;0;internal:/node/270;Coût de la scolarité en initial Hors contrat;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;18;570;fr;0;internal:/node/270;Coût de la scolarité en initial Hors contrat;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;32;32;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;33;33;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";a:0:{}}"
page_fiche_formation;0;219;247;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";<strong>s:6:""</strong>a:0:{}"";}"
page_fiche_formation;0;262;476;fr;0;internal:/node/270;Coût de la scolarité en initial Hors contrat;"a:1:{s:10:""attributes"";a:0:{}}"

Difference is in the field_lien_interne_options field table.
page_fiche_formation;0;219;247;fr;0;internal:/node/21;Coût de la scolarité;"a:1:{s:10:""attributes"";s:6:""a:0:{}"";}"
Is someone know what kind of option is it ? Could it be the error origin ?

aiphes’s picture

I test on another content type and I notice that records that contains "a:1:{s:10:""attributes"";s:32:""a:1:{s:6:""target"";s:6:""_blank"";}"";}" in the field_lien_internet_rp_options break CRON with linkgenerator error and content give a WSOD ( node__field_lien_internet_rp db table)
I edit this content and re-save it, and error disappear + CRON work again.
In db record, the field_lien_internet_rp_options contain now a:0:{} and all is as designed. But I don't know what s:32: is related (option of CCK linkfield for sure but which one ?) ans I don't know how to do a MySQL query to replace it in the db after migration because this data is in a blob.

aiphes’s picture

New migration on another server and errors are back : but I found the way to modify blob content like this:
update node__field_lien_interne set field_lien_interne_options=replace(field_lien_interne_options, 'a:0:{}', 'a:1:{s:10:"attributes";a:0:{}}') where field_lien_interne_options like '%a:0:{}%';

I just need to put the replaced string as absolute, otherwise all records are affected in the table because of the replaced string is too much generic.

Drupal version                  :  8.6.14
Drush version                   :  8.1.15

Version: 8.6.1 » 8.6.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Version: 8.6.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Bug Smash Initiative

@aiphes, Did you resolve this problem? If so, what did you do?

I've been working on the related migration issue and there is a working patch there now. I do appreciate that you are likely to have found a solution in the meantime.

aiphes’s picture

Hello

since I do migration on D8.9 this issue disappeared.
The only thing noticiable, is the none mention on linkfield after migration.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

@aiphes, thanks for reporting back! I am glad to found a solution.

According to #18, this has been resolved by migrating to Drupal 8.9. I am closing this as outdated.