Failed migration craft 2 to craft 3 - array_key_exists() expects parameter 2 to be array, null given
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
Description
I am getting an error while trying to migrate craft 2 to craft 3. Here are some details about the craft version that I am using.
craft 2 version - Craft CMS 2.7.10
craft 3 version - Craft CMS 3.0.41
I have tried to google and search old issues, but I have not found anything that works for me. I have spent about 4 hours on this, I would really appreciate if someone can point me in the right direction.
Error Log
yii\base\ErrorException: array_key_exists() expects parameter 2 to be array, null given
Migration: craft\migrations\m160707_000001_rename_richtext_assetsource_setting
Output:
> update in {{%fields}} ... done (time: 0.006s)
> update in {{%fields}} ... done (time: 0.001s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
> update in {{%fields}} ... done (time: 0.000s)
Exception: array_key_exists() expects parameter 2 to be array, null given (/Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/migrations/m160707_000001_rename_richtext_assetsource_setting.php:28)
#0 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler->handleError(2, 'array_key_exist...', '/Users/v.hooda/...', 28)
#1 [internal function]: craft\web\ErrorHandler->handleError(2, 'array_key_exist...', '/Users/v.hooda/...', 28, Array)
#2 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/migrations/m160707_000001_rename_richtext_assetsource_setting.php(28): array_key_exists('availableAssetS...', NULL)
#3 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/db/Migration.php(56): craft\migrations\m160707_000001_rename_richtext_assetsource_setting->safeUp()
#4 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/db/MigrationManager.php(243): craft\db\Migration->up(true)
#5 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/db/MigrationManager.php(163): craft\db\MigrationManager->migrateUp(Object(craft\migrations\m160707_000001_rename_richtext_assetsource_setting))
#6 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/services/Updates.php(207): craft\db\MigrationManager->up()
#7 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(519): craft\services\Updates->runMigrations(Array)
#8 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/controllers/UpdaterController.php(208): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db')
#9 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#10 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#12 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('migrate', Array)
#13 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('migrate', Array)
#14 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/Application.php(284): yii\base\Module->runAction('updater/migrate', Array)
#15 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/Application.php(670): craft\web\Application->runAction('updater/migrate')
#16 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/Application.php(215): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#17 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#18 /Users/v.hooda/Sites/mvb-vlb-v3/web/index.php(24): yii\base\Application->run()
#19 {main}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with vendor/craftcms/cms/src/migrations/m160707_000001_rename_richtext_assetsource_setting.php at line 28, then reproduce the Craft 2 to Craft 3 migration using the error log details. Determine why the migration receives null for the affected setting and verify that the migration completes without the array_key_exists() exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100