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

BaseOptionsField.php error #5533

Closed
LouisCuvelier opened this issue Jan 29, 2020 · 25 comments
Closed

BaseOptionsField.php error #5533

LouisCuvelier opened this issue Jan 29, 2020 · 25 comments

Comments

@LouisCuvelier
Copy link

Description

After upgrading to 3.4, I'm facing this issue. It's similar to #5014

2020-01-29 16:41:25 [-][1][jn2lalrtblm1vm3k0un961ap4d][error][RuntimeException] yii\base\ErrorException: Undefined index: value in /home/coursierjob-staging/webapps/coursierjob-staging/vendor/craftcms/cms/src/fields/BaseOptionsField.php:427

Steps to reproduce

  1. Update to Craft 3.4
  2. Open an entry with a dropdown field

Additional info

  • Craft version: 3.4.0.2
  • PHP version: 7.3.13
  • Database driver & version: MySQL 5.5.5
  • Plugins & versions:
{
    "aelvan/imager": "v2.3.1",
    "aelvan/preparse-field": "v1.1.0",
    "codemonauts/craft-redactor-nofollow": "1.0.0",
    "craftcms/anchors": "2.2.0",
    "craftcms/cms": "3.4.0.2",
    "craftcms/redactor": "2.5.0",
    "craftsnippets/table-of-contents": "1.0.2",
    "doublesecretagency/craft-upvote": "2.0.4",
    "ether/simplemap": "3.7.7",
    "jalendport/craft-readtime": "1.6.0",
    "mmikkel/retcon": "2.0.12",
    "nesbot/carbon": "^2.23.1",
    "nystudio107/craft-disqus": "1.1.2",
    "nystudio107/craft-eagerbeaver": "1.0.4",
    "nystudio107/craft-emptycoalesce": "1.0.6",
    "nystudio107/craft-minify": "1.2.9",
    "nystudio107/craft-retour": "3.1.33",
    "nystudio107/craft-seomatic": "3.2.39",
    "nystudio107/craft-templatecomments": "1.1.2",
    "nystudio107/craft-typogrify": "^1.1",
    "putyourlightson/craft-blitz": "3.1.1",
    "topshelfcraft/supersort": "3.0.1",
    "verbb/field-manager": "2.1.1",
    "verbb/image-resizer": "2.0.6",
    "verbb/super-table": "2.4.0",
    "vlucas/phpdotenv": "^3.6",
    "wrav/oembed": "1.1.8"
}
@brandonkelly
Copy link
Member

Can you please send a database backup from before updating to Craft 3.4, plus your composer.json and composer.lock files, over to support@craftcms.com , and reference this issue URL + where the error is occurring?

@LouisCuvelier
Copy link
Author

Done 😊

@LouisCuvelier
Copy link
Author

Ok with the help of @olivierbon, I found a solution.

I don't know why, but after updating to 3.4, the folder /storage/config-deltas was pushed on the git server even with the .gitignore.

So all my dropdown fields were empty on my staging and prod server.

Removing config-deltas from git, rebuilding project config and pushing again fix the whole thing.

Thanks for your help 😊

@brandonkelly
Copy link
Member

Glad you got it sorted!

@henrypenny
Copy link

I've encountered the same problem. I've tried doing the rebuild and still have an error.

In BaseOptionsField.php line 427:

if (!isset($option['optgroup']) && (string)$option['value'] === $value) {

The code is looking for $option['value'], however $option looks like this:

  '__assoc__' => 
  array (
    0 => 
    array (
      0 => 'label',
      1 => 'Default',
    ),
    1 => 
    array (
      0 => 'value',
      1 => 'default',
    ),
    2 => 
    array (
      0 => 'default',
      1 => '1',
    ),
  ),
)```

@brandonkelly
Copy link
Member

@henrypenny same request to you, then: #5533 (comment)

@henrypenny
Copy link

I've sent those to support.
Thanks.

@ostark
Copy link
Contributor

ostark commented Feb 19, 2020

I had the same error today (after messing around with Craft 3.3 > 3.4 + project.yml).
Removing the QuickPostWidget from the widgets table solved it.

@brandonkelly
Copy link
Member

@ostark do you happen to have a DB backup from before you deleted the widget? If not, are you able to reproduce the error again if you re-add the widget with the same settings?

@ostark
Copy link
Contributor

ostark commented Jul 1, 2020

@brandonkelly looks like I have a DB backup (after update, before removing the widget).

@brandonkelly
Copy link
Member

I was able to reproduce this with @ostark’s backup. Somehow, some of the associative arrays within the project config got double-packed as __assoc__ arrays.

I’ve added a guard against that, so associative arrays that already contain an __assoc__ key won’t get double-packed, and I’ve added a new utils/repair/project-config command that you can run to clean up any existing double-packed arrays.

@davidhellmann
Copy link
Contributor

davidhellmann commented Jul 3, 2020

@brandonkelly
When I run utils/repair/project-config my Project Config do changes like this:
image

But when I run project-config/rebuild it becomes reversed?
image

@brandonkelly
Copy link
Member

@davidhellmann there was a bug in 3.4.26 which was fixed in 3.4.27. Sorry about that.

@davidhellmann
Copy link
Contributor

@brandonkelly yes, I'm on 3.4.27 and the screens are created with this version :)

@peimansh
Copy link

peimansh commented Jul 21, 2020

@brandonkelly
I'm still seeing the same behaviour when running
utils/repair/project-config
and then
project-config/rebuild
on 3.4.28.1

@brandonkelly
Copy link
Member

@davidhellmann @peimansh Can you both please send your composer.json and composer.lock files, and a database backup, over to support@craftcms.com ?

@peimansh
Copy link

peimansh commented Jul 22, 2020

@brandonkelly Done !

I even updated and tried on 3.4.29 but still no luck.

@ricricucit
Copy link
Contributor

ricricucit commented Aug 20, 2020

I can confirm that the same error as @davidhellmann still occurs on craft 3.5.4, meaning:

  1. ./craft project-config/rebuild adds __assoc__ stuff
  2. ./craft utils/repair/project-config cleans it up

@brandonkelly
Copy link
Member

@ricricucit What plugins do you have installed?

@ricricucit
Copy link
Contributor

Plugin Version
Amazon S3 1.2.9
Asset Usage 2.1.0
Embedded Assets 2.3.3
inxmail 0.1.0
Migration Assistant 3.1.8
Navigation 1.3.26
Publication Orders 1.0.0
Redactor 2.7.1
Redactor Custom Styles 3.0.4
Related 1.1.3
Retour 3.1.41
Search 1.0.0
Tags 1.0.7
Translations 2.3.2

@brandonkelly
Copy link
Member

I remember hearing that there‘s a plugin that is still causing the double-packed arrays, but none of those are ringing a bell. If you run project-config/rebuild immediately after utils/repair/project-config, do they show up again? If not, please try to determine what exactly is adding the double-packed arrays, by running project-config/rebuild each time something changes.

@peimansh
Copy link

In my case it is the "Linkit" plugin

@ricricucit
Copy link
Contributor

I cannot uninstall plugins, but yes: I keep runnign utils/repair/project-config, which helps.

@peimansh
Copy link

Any fixes being baked ? @brandonkelly
I'm still experiencing the issue and with every change my project.yaml structure gets back to the old duplicated model and I have to run ./craft utils/repair/project-config to fix it.
it even happens when I rebuild project.yaml

@brandonkelly
Copy link
Member

@peimansh Please send your Composer files and a database backup into support@craftcms.com, and give us an example of something we can change that will cause the issue.

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

7 participants