Loading core/modules/link/src/Plugin/migrate/process/FieldLink.php +3 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,9 @@ public function transform($value, MigrateExecutableInterface $migrate_executable $attributes = unserialize($attributes); } if (!$attributes) { // In rare cases Drupal 6/7 link attributes are triple serialized. To avoid // further problems with them we set them to an empty array in this case. if (!is_array($attributes)) { $attributes = []; } Loading core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php +23 −0 Original line number Diff line number Diff line Loading @@ -89,4 +89,27 @@ public function canonicalizeUriDataProvider() { ]; } /** * Test the attributes that are deeply serialized are discarded. */ public function testCanonicalizeUriSerialized() { $link_plugin = new FieldLink([], '', [], $this->getMock(MigrationInterface::class)); $migrate_executable = $this->getMock(MigrateExecutableInterface::class); $row = new Row(); $transformed = $link_plugin->transform([ 'url' => '', 'title' => '', 'attributes' => serialize(serialize(['not too deep'])), ], $migrate_executable, $row, NULL); $this->assertEquals(['not too deep'], $transformed['options']['attributes']); $transformed = $link_plugin->transform([ 'url' => '', 'title' => '', 'attributes' => serialize(serialize(serialize(['too deep']))), ], $migrate_executable, $row, NULL); $this->assertEmpty($transformed['options']['attributes']); } } Loading
core/modules/link/src/Plugin/migrate/process/FieldLink.php +3 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,9 @@ public function transform($value, MigrateExecutableInterface $migrate_executable $attributes = unserialize($attributes); } if (!$attributes) { // In rare cases Drupal 6/7 link attributes are triple serialized. To avoid // further problems with them we set them to an empty array in this case. if (!is_array($attributes)) { $attributes = []; } Loading
core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php +23 −0 Original line number Diff line number Diff line Loading @@ -89,4 +89,27 @@ public function canonicalizeUriDataProvider() { ]; } /** * Test the attributes that are deeply serialized are discarded. */ public function testCanonicalizeUriSerialized() { $link_plugin = new FieldLink([], '', [], $this->getMock(MigrationInterface::class)); $migrate_executable = $this->getMock(MigrateExecutableInterface::class); $row = new Row(); $transformed = $link_plugin->transform([ 'url' => '', 'title' => '', 'attributes' => serialize(serialize(['not too deep'])), ], $migrate_executable, $row, NULL); $this->assertEquals(['not too deep'], $transformed['options']['attributes']); $transformed = $link_plugin->transform([ 'url' => '', 'title' => '', 'attributes' => serialize(serialize(serialize(['too deep']))), ], $migrate_executable, $row, NULL); $this->assertEmpty($transformed['options']['attributes']); } }