Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
migration system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Nov 2014 at 19:54 UTC
Updated:
16 Sep 2015 at 13:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
eliza411 commentedComment #2
benjy commentedA test should be quite easy, we just need to add a block to our dumps that is provided by the block module and then assert it is migrated.
Settings to NR for the bot although it's pretty obvious this code path isn't run anyway :)
Comment #3
ultimike@benjy,
A block provided by the block module? That's just a custom block, right? If so, there are already four of them in the Drupal6Block dump and we're testing all of them in MigrateBlockTest.
Or - am I missing something?
-mike
Comment #4
benjy commentedWow, so it was another PHP WTF :)
This is the current code, but when we have a numeric id, it still works because PHP dereferences the first character of the string for us, which is "4".
So we would have issues with collisions. Eg, block id 1 would end up with the same block id as block 12. Patch attached shows the issue.
Also, the block ids are generated using the block delta and not the block id which I also think is wrong.EDIT: $delta is unique once we've filtered on module so the last part of my comment is wrong.
Comment #5
benjy commentedSo I added a test that causes a collisisson but it seems that core doesn't care if $block->plugin have identical values across blocks. So, not sure at this point what the value of $block_ids was which caused the issue.
Comment #6
chx commentedComment #7
alexpottFrom
Drupal\migrate\Plugin\migrate\process\Migration::transform(). This looks a little iffy - if we just returned$destination_idsit'd always be an array and we'd be more consistent.Comment #8
chx commentedwaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
I had that originally and then people were pushing back at that because 99% of the time you have single-to-single mapping and so they wanted this back from D7.
Comment #9
alexpott@chx ho hum... I don't know every bit of migration code history :)
Just noting that it is this type of magic that just gets us into problems since it is runtime determined.
Comment #10
chx commentedAh, I know: multiple handling is enabled by this. Yes, more magic, but very useful magic.
Comment #11
alexpottDon't we need to just create one block with an id greater than > 9 and have no other blocks?
I think we should have a test here.
Comment #12
benjy commentedHmm, I tried this at the weekend and the problem is, if we create a block with an id > than 9 say, 11, but a box with an id of 1 doesn't exist, we get a fatal error in the test.
However, if we create the box with id 1, we end up with two blocks (one for block 1 and another for block 11) that both have $block->plugin values that are equal. And core has no problem with that.
We could assert specifically that they should have separate $block->plugin values which would work for this bug, but it's very specific?
I'm also open to other approaches to testing this bug if someone has a better idea.
Comment #13
chx commentedAh yes, of course, we can just add an id 99 and then it'll blow up cos there's no 9.
Comment #14
benjy commentedNot sure about #13, when I did that as I mentioned in #12, I get a fatal error regardless of this patch.
Comment #15
pushkarpathak commentedThe patch worked for me. I am using beta4. Earlier I was getting following error message:
Running d6_block [ok]
Fatal error: Call to a member function uuid() on a non-object in C:\wamp\www\bet
a4\core\modules\migrate_drupal\src\Plugin\migrate\process\d6\BlockPluginId.php o
n line 87
Call Stack:
0.0000 134424 1. {main}() C:\Users\idsa\AppData\Roaming\Composer\vendo
r\drush\drush\drush.php:0
0.0312 1689896 2. drush_main() C:\Users\idsa\AppData\Roaming\Composer\v
endor\drush\drush\drush.php:16
0.4680 5047456 3. Drush\Boot\DrupalBoot->bootstrap_and_dispatch() C:\Us
ers\idsa\AppData\Roaming\Composer\vendor\drush\drush\drush.php:76
1.4820 14364056 4. drush_dispatch() C:\Users\idsa\AppData\Roaming\Compos
er\vendor\drush\drush\lib\Drush\Boot\DrupalBoot.php:46
1.8564 15818528 5. call_user_func_array:{C:\Users\idsa\AppData\Roaming\C
omposer\vendor\drush\drush\includes\command.inc:178}() C:\Users\idsa\AppData\Roa
ming\Composer\vendor\drush\drush\includes\command.inc:178
1.8564 15818792 6. drush_command() C:\Users\idsa\AppData\Roaming\Compose
r\vendor\drush\drush\includes\command.inc:178
1.8564 15819424 7. _drush_invoke_hooks() C:\Users\idsa\AppData\Roaming\C
omposer\vendor\drush\drush\includes\command.inc:210
1.8720 15841248 8. call_user_func_array:{C:\Users\idsa\AppData\Roaming\C
omposer\vendor\drush\drush\includes\command.inc:359}() C:\Users\idsa\AppData\Roa
ming\Composer\vendor\drush\drush\includes\command.inc:359
1.8720 15841528 9. drush_migrate_manifest() C:\Users\idsa\AppData\Roamin
g\Composer\vendor\drush\drush\includes\command.inc:359
139.1053 34161384 10. Drupal\migrate\MigrateExecutable->import() C:\Users\i
dsa\AppData\Roaming\Composer\vendor\drush\drush\commands\core\migrate.d8.drush.i
nc:51
142.8533 39375656 11. Drupal\migrate\MigrateExecutable->processRow() C:\wam
p\www\beta4\core\modules\migrate\src\MigrateExecutable.php:275
142.8689 39397392 12. Drupal\migrate_drupal\Plugin\migrate\process\d6\Block
PluginId->transform() C:\wamp\www\beta4\core\modules\migrate\src\MigrateExecutab
le.php:398
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to a member function uuid() on a non-object in
C:\wamp\www\beta4\core\modules\migrate_drupal\src\Plugin\migrate\process\d6\Bloc
kPluginId.php,
line 87
Comment #16
ultimikeComment #17
ultimikeSo what needs to be done to get a test created for this? Add a bunch of custom blocks so that we ensure that block_id=10 doesn't mess with block_id=1?
-mike
Comment #18
lokapujyaSince we don't want to do #7, then the plan in #11 sounds simple and I think covers the problem. Should we update the interface to document the possibility for array $value and return types? It's documented in the params, but not the description. Also, the $value could be int|string|array instead of mixed, I think. Plus the @throws is not documented.
Regarding the fatal error encountered in #12, we could throw an exception if $destination_ids is empty.
Comment #19
bdone commentedi've got data produces this bug that looks like below, and applying this patch fixes things.
as mentioned in #14 MigrateBlockTest::testBlockMigration() produces a fatal when adding a new test custom block row, with a higher block id (99). not sure how to get started on adding to the tests for this but happy to try, with guidance.
Comment #20
mikeryanBump - this fell off the radar, but it totally breaks migrations for sites with a significant number of (perhaps historical) blocks, we need to address it.
Comment #21
dbourrion commentedHi
Using the very last dev version of D8 core, had that same error.
But the patch #19 can't be apply anymore, because the core/modules/migrate_drupal/src/Plugin/migrate/process/ doesnt look a valid path anymore.
Best regards
D.
Comment #22
dbourrion commentedComment #23
benjy commentedNeeds work is the correct status for an issue with a patch that needs additional work. Setting back to NW and adding the re-roll tag.
Comment #24
quietone commentedJust the reroll
Comment #25
quietone commentedComment #28
quietone commentedTest for 11 blocks, not 10. Add tests for the eleventh block.
Comment #29
quietone commentedComment #30
dbourrion commentedHi
Patch #28 solve the error for me, many many thanks.
D.
Comment #31
benjy commented@quietone thanks for writing a test. Can you upload a FAIL version of the patch, eg just the test without the fix?
Comment #32
quietone commented@benjy, I can't produce a failure. I removed the fix and it ran happily. From #13, I tried removing the block with bid 1 and that just results in the migration never ending.
On one attempt I checked the $block->plugin values, and curiously they were alternating between 2 values. I had 5 blocks 3 with one of the values and 2 with the other.
Comment #33
phenaproximaThis is addressed separately in #2408165: Migration Files for Drupal 7 Blocks; credited @quietone, @eliza411 and @bdone there.