Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed migration craft 2 to craft 3 - array_key_exists() expects parameter 2 to be array, null given #5447

Open
vasuhooda opened this issue Jan 16, 2020 · 4 comments

Comments

@vasuhooda
Copy link

vasuhooda commented Jan 16, 2020

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}
@andris-sevcenko
Copy link
Contributor

This has been fixed in Craft 3.1, so you'll have to upgrade to at least 3.1 instead of 3.0.41.
If, for some reason, you want to stay on 3.0.x, then you'll have to manually edit that migration file to apply the changes in the ba34928 commit.

@vasuhooda
Copy link
Author

vasuhooda commented Jan 16, 2020

Hello @andris-sevcenko ,

Thanks for the quick response. I updated craft, but I am still getting error.

Screenshot 2020-01-16 at 10 20 10

Error Log

Unknown Property: Setting unknown property: craft\fields\Assets::configFile

Migration: craft\migrations\m180521_173000_initial_yml_and_snapshot

Output:

> add column config mediumtext NULL DEFAULT NULL AFTER maintenance to table {{%info}} ... done (time: 0.017s)
> add column configMap mediumtext NULL DEFAULT NULL AFTER config to table {{%info}} ... done (time: 0.016s)
Exception: Setting unknown property: craft\fields\Assets::configFile (/Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/Component.php:209)
#0 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/BaseYii.php(546): yii\base\Component->__set('configFile', 'minimal.json')
#1 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\fields\Assets), Array)
#2 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/fields/BaseRelationField.php(172): yii\base\BaseObject->__construct(Array)
#3 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/helpers/Component.php(80): craft\fields\BaseRelationField->__construct(Array)
#4 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/services/Fields.php(546): craft\helpers\Component::createComponent(Array, 'craft\\base\\Fiel...')
#5 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/services/Fields.php(571): craft\services\Fields->createField(Array)
#6 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/services/Fields.php(613): craft\services\Fields->getAllFields(false)
#7 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/migrations/m180521_173000_initial_yml_and_snapshot.php(306): craft\services\Fields->getFieldById(1)
#8 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/migrations/m180521_173000_initial_yml_and_snapshot.php(77): craft\migrations\m180521_173000_initial_yml_and_snapshot->_getFieldData()
#9 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/migrations/m180521_173000_initial_yml_and_snapshot.php(40): craft\migrations\m180521_173000_initial_yml_and_snapshot->_getProjectConfigData()
#10 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/db/Migration.php(56): craft\migrations\m180521_173000_initial_yml_and_snapshot->safeUp()
#11 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/db/MigrationManager.php(243): craft\db\Migration->up(true)
#12 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/db/MigrationManager.php(163): craft\db\MigrationManager->migrateUp(Object(craft\migrations\m180521_173000_initial_yml_and_snapshot))
#13 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/services/Updates.php(215): craft\db\MigrationManager->up()
#14 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(445): craft\services\Updates->runMigrations(Array)
#15 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/controllers/UpdaterController.php(208): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db')
#16 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#17 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#18 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#19 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller->runAction('migrate', Array)
#20 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('migrate', Array)
#21 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module->runAction('updater/migrate', Array)
#22 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/Application.php(683): craft\web\Application->runAction('updater/migrate')
#23 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/craftcms/cms/src/web/Application.php(223): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#24 /Users/v.hooda/Sites/mvb-vlb-v3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#25 /Users/v.hooda/Sites/mvb-vlb-v3/web/index.php(24): yii\base\Application->run()
#26 {main}

@andris-sevcenko
Copy link
Contributor

Can you try updating straight from Craft 2 to Craft 3.1 and see if that issue persists?

If it does, can you get in touch over [email protected], reference this issue, and attach your (pre-upgrade) database dump as well so we can look into that?

@vasuhooda
Copy link
Author

vasuhooda commented Jan 16, 2020

@andris-sevcenko

Yes, the issue still persists even when I use fresh database copy to update directly from Craft 2 to Craft 3.1

I have sent an email with the pre-upgrade database dump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants