Closed (fixed)
Project:
Migrate
Version:
6.x-2.3
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Reporter:
Created:
22 May 2012 at 18:31 UTC
Updated:
7 Jun 2012 at 19:31 UTC
Jump to comment: Most recent file
If there is no data in the arguments column of the migrate_status table, unserialize($row->arguments) will return FALSE, and FALSE (instead of the expected array) will be passed to getInstance() as the third parameter.
Proposing the following change:
<?php
- $migration = MigrationBase::getInstance($row->machine_name,
- $row->class_name, unserialize($row->arguments));
+ $arguments = unserialize($row->arguments);
+ if (!$arguments || !is_array($arguments)) {
+ $arguments = array();
+ }
+ $migration = MigrationBase::getInstance($row->machine_name,
+ $row->class_name, $arguments);
?>If you agree, I'm happy to roll the patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | arg3_as_array-1595056-1.patch | 1.32 KB | apotek |
Comments
Comment #1
apotek commentedHere 'tis.
Comment #2
mikeryanI was going to suggest just an update function to make sure arguments was always properly populated, but it looks like there's the potential for beginProcess() to lazy-create rows without arguments, so this looks good, I'll test it in a bit...
Thanks.
Comment #3
apotek commentedHaving second thoughts already. Wondering if it would be better to cast the $arguments to an array rather than reset to an empty array. Hmmm.
This is bulky, but perhaps the safest:
What happens if we simply do this?:
$arguments = (array) unserialize($row->arguments);
which could create an array like so:
Is that so bad? Might that have unintended consequences if one of the arguments is empty or boolean?
Let me know if you would prefer me to leave as is, or roll a new patch with either one of the options above.
Comment #4
mikeryanI've committed the original patch, it looks fine. I don't see any way the arguments could be anything other than empty or a serialized array.
Comment #5
apotek commentedGreat! Thanks mikeryan
Comment #6.0
(not verified) commentedclarified the introductory sentence.